Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)相关的知识,希望对你有一定的参考价值。
?????????turn string ????????? ????????? text tin ???????????? break out
D???fst??????????????????????????????rated???CF?????????????????????
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> using namespace std; int n,x[105],part=1; bool f=1; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&x[i]); if(part==1) {if(x[i]==x[i-1])part=2;else if(x[i]<x[i-1])part=3;} else if(part==2) {if(x[i]<x[i-1])part=3;else if(x[i]>x[i-1]){f=0;break;}} else if(part==3) {if(x[i]>x[i-1]){f=0;break;}else if(x[i]==x[i-1]){f=0;break;}} } if(f)printf("YES\n"); else printf("NO\n"); return 0; }
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> using namespace std; char a[26],b[26],s[1001]; int map[26]; int main() { scanf("%s%s%s",a,b,s); for(int i=0;i<26;i++) map[a[i]-???a???]=b[i]-???a???; for(int i=0;i<strlen(s);i++) { if(s[i]>=???a???&&s[i]<=???z???)cout<<(char)(map[(int)(s[i]-???a???)]+???a???); else if(s[i]>=???A???&&s[i]<=???Z???)cout<<(char)(map[(int)(s[i]-???A???)]+???A???); else cout<<s[i]; } return 0; }
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> typedef long long LL; int n,k,p,a[1005],b[2005]; using namespace std; LL dis(LL x,LL y){return abs(y-x)+abs(p-y);} bool check(LL mid) { int j=1; for(int i=1;i<=n;i++,j++) { while(j<=k&&dis(a[i],b[j])>mid)++j; if(j>k)return false; } return true; } int main() { scanf("%d%d%d",&n,&k,&p); for(int i=1;i<=n;i++)scanf("%d",&a[i]); for(int i=1;i<=k;i++)scanf("%d",&b[i]); sort(a+1,a+1+n),sort(b+1,b+1+k); LL l=0,r=2000000000,ans; while(l<=r) { LL mid=(l+r)>>1; if(check(mid))ans=mid,r=mid-1; else l=mid+1; } printf("%I64d\n",ans); return 0; }
以上是关于Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #424 (Div. 2) A-C
Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem F (Codeforces 831F) - 数论 - 暴力(
Codeforces Round #424 (Div. 2) D 思维 E set应用,树状数组
Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)
Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 831D) - 贪心 - 二分答
Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Cards Sorting(树状数组)