基本全是水题

第一题水,不过有hack点,先增后不变再减

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
cin>>n;
bool f=;
int last,bh=;
for(int i=;i<n;i++)
{
int a;
cin>>a;
if(i==)last=a;
else
{
if(last<a)
{
if(bh==)last=a;
else if(bh==)f=;
else f=;
}
else if(last==a)
{
if(bh==)bh=,last=a;
else if(bh==)last=a;
else f=;
}
else if(last>a)
{
if(bh==)bh=,last=a;
else if(bh==)bh=,last=a;
else last=a;
}
}
}
if(f)cout<<"NO"<<endl;
else cout<<"YES"<<endl;
return ;
}

A

第二题更水,6分钟1a,maphash一下就行了

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; map<char,char>m;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
string s,p,t;
cin>>s>>p>>t;
for(int i=;i<s.size();i++)
{
m[s[i]]=p[i];
}
for(int i=;i<t.size();i++)
{
if('a'<=t[i]&&t[i]<='z')cout<<m[t[i]];
else if('A'<=t[i]&&t[i]<='Z')cout<<(char)(m[t[i]-'A'+'a']+'A'-'a');
else cout<<t[i];
}
cout<<endl;
return ;
}

B

第三题想法题,先sort,然后找间距一一对应起来就可以 了(刚开始想的是求出值来,太蠢了)

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; ll a[N],b[N];
ll sum[N];
set<ll>ans;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
ll k,n;
cin>>k>>n;
for(ll i=;i<k;i++)
{
cin>>a[i];
if(i==)sum[i]=a[i];
else sum[i]=sum[i-]+a[i];
}
for(ll i=;i<n;i++)cin>>b[i];
sort(b,b+n);
sort(sum,sum+k);
int p=b[];
for(int i=;i<n;i++)b[i]-=p;
ll i=;
for(int i=;i<k;i++)
{
int res=,p=;
for(int j=i;j<k;j++)
{
if(sum[j]-sum[i]==b[p])
p++;
if(p>=n)
{
ans.insert(sum[i]);
break;
}
}
}
cout<<ans.size()<<endl;
return ;
}

C

第四题,给一堆人,和一堆钥匙的坐标,每个人拿钥匙去办公室,求最小时间,sort一下,然后二分最小时间,每次判断的时候还是枚举两个数组进行匹配

#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; ll a[N],b[N],p,n,k;
bool ok(ll i,ll j,ll x)
{
return abs(a[i]-b[j])+abs(b[j]-p)<=x;
}
bool check(ll x)
{
ll j=;
for(int i=;i<n;i++)
{
while(!ok(i,j,x)){
j++;
}
if(j>=k)return ;
j++;
}
return ;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie();
cin>>n>>k>>p;
for(ll i=;i<n;i++)cin>>a[i];
for(ll i=;i<k;i++)cin>>b[i];
sort(a,a+n);
sort(b,b+k);
ll l=,r=2e9+;
for(int i=;i<;i++)
{
ll m=(l+r)/;
if(check(m))r=m;
else l=m;
}
while(check(l))l--;
cout<<l+<<endl;
return ;
}

D

第5.6先留坑

话说这场只a了两题,还好比较稳,没被hack,还涨了85分>.<

Codeforces Round #424的更多相关文章

  1. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)

    http://codeforces.com/contest/831 A. Unimodal Array time limit per test 1 second memory limit per te ...

  2. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A,B,C

    A:链接:http://codeforces.com/contest/831/problem/A 解题思路: 从前往后分别统计递增,相等,递减序列的长度,如果最后长度和原序列长度相等那么就输出yes: ...

  3. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem F (Codeforces 831F) - 数论 - 暴力

    题目传送门 传送门I 传送门II 传送门III 题目大意 求一个满足$d\sum_{i = 1}^{n} \left \lceil \frac{a_i}{d} \right \rceil - \sum ...

  4. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 831D) - 贪心 - 二分答案 - 动态规划

    There are n people and k keys on a straight line. Every person wants to get to the office which is l ...

  5. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem E (Codeforces 831E) - 线段树 - 树状数组

    Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this int ...

  6. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 831C) - 暴力 - 二分法

    Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain ...

  7. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem A - B

    Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is cons ...

  8. 【Codeforces Round #424 (Div. 2) A】Unimodal Array

    [Link]:http://codeforces.com/contest/831/problem/A [Description] 让你判断一个数列是不是这样一个数列: 一开始是严格上升 然后开始全都是 ...

  9. 【Codeforces Round #424 (Div. 2) B】Keyboard Layouts

    [Link]:http://codeforces.com/contest/831/problem/B [Description] 两个键盘的字母的位置不一样; 数字键的位置一样; 告诉你第一个键盘按某 ...

  10. 【Codeforces Round #424 (Div. 2) C】Jury Marks

    [Link]:http://codeforces.com/contest/831/problem/C [Description] 有一个人参加一个比赛; 他一开始有一个初始分数x; 有k个评委要依次对 ...

随机推荐

  1. python中is和==区别

    is比较两个对象的id值是否相等,是否指向同一个内存地址 ==比较的是两个对象的内容是否相等,值是否相等 is运算符比==效率高,在变量和None进行比较时,应该使用is

  2. ruby中的self

    self,自己,在ruby中表示当前对象或默认对象.程序执行的任一时刻,有且仅有一个self. 1.谁成为self,在什么位置成为self? 要知道哪个对象是self,就必须知道当前的上下文.上下文主 ...

  3. topcoder SRM712 Div1 LR

    题目: Problem Statement      We have a cyclic array A of length n. For each valid i, element i-1 the l ...

  4. Salesforce中Html的转义,InputField和RemoteAction

    在Salesforce的开发中,有时候需要在对象中插入记录,其中有的字段需要插入Html,但是对于输入Html的域,大多数框架和网站都需要做Html的转义处理,防止XSS或者SQL注入攻击.有时候我们 ...

  5. 这几天添加ccbi 出现的问题

    父类是一个ccbi...在父类的onNodeLoaded 里面添加子类的ccbi ... 出现了父类为空的情况...获取不到时间轴..动画为空... 需要在父类的onEnter里面写添加子类的ccbi ...

  6. springCloud4---feign

    JAX-WS : soap是遵循这个标准. JAX-RS : 标准,jersey框架遵循这个标准. Feign是一个声明式的web service客户端.Feign使用的负载均衡也是ribbon,Fe ...

  7. LigerUI ligerComboBox 下拉框 表格 多选无效

    $("#txt1").ligerComboBox({ width: 250, slide: false, selectBoxWidth: 500, selectBoxHeight: ...

  8. AndroidStudio 使用AIDL

    http://blog.csdn.net/ducklikejava/article/details/51559244 Android Studio中写的一个AIDL的小DEMO. 步骤很繁琐,本来不准 ...

  9. 【HTML5校企公益课】第一天

    1.搭建基本的开发环境.学校电脑用的是浏览器是Chrome,编辑器是HBuilder. 2.初步介绍HTML5的Web项目基本结构. css:样式表 img:存放图片 js:存放脚本文件 .html: ...

  10. Linux学习笔记之CentOS6.9 防火墙的关闭以及开启

    有的时候,我们需要对系统的防火墙进行操作,今天小编就给大家讲解一下如何开启以及关闭CentOS6.9系统下的防火墙. 输入:cat /etc/issue   查看版本 (一)通过service命令 s ...