## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (F) Bamboo Partition Solution In C/C++

By |2017-07-24T17:50:48+06:00July 24th, 2017|Categories: Uncategorized||

#include<cstdio> #include<algorithm> using namespace std; int n,a[110]; long long k,ans=0; int main(){ scanf("%d%lld",&n,&k); for (int i=1; i<=n; i++) scanf("%d",&a[i]); for (long long l=1,r; l<=1LL<<62; l=r+1){ // printf("%lld %lld\n",l,r); long long cnt=0,weight=0; r=1LL<<62; for (int i=1; i<=n; i++){ cnt+=(((a[i]-1)/l)+1)*l-a[i]; weight+=(a[i]-1)/l+1; if ((a[i]>l) && ((a[i]-1)/((a[i]-1)/l) < [...]

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (D) Office Keys Solution In C/C++

By |2017-07-24T17:46:49+06:00July 24th, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> using namespace std; const int maxn=2e3+5; int main(){ int n,k,p,a[maxn],b[maxn]; int res=INT_MAX,i,j; cin>>n>>k>>p; for(i=0;i<n;i++) scanf("%d",a+i); for(i=0;i<k;i++) scanf("%d",b+i); sort(a,a+n); sort(b,b+k); for(i=0;i<=k-n;i++){ int t=0; for(j=0;j<n;j++) t=max(t,abs(a[j]-b[i+j])+abs(p-b[i+j])); res=min(t,res); } cout<<res; return 0; }

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (C) Jury Marks Solution In C/C++

By |2017-07-24T17:45:19+06:00July 24th, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>k>>n; int t; int arr[k]; set<int>c; for(int i=0;i<k;i++){ cin>>t; arr[i]= arr[i-1]+t; } for(int i=0;i<n;i++){ cin>>t; set<int>mmp; for(int j=0;j<k;j++){ int x = t-arr[j]; if(!i||(c.find(x) != c.end())){ mmp.insert(x); } } c =mmp; } cout<<c.size(); return 0; }

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (B) Keyboard Layouts Solution In C/C++

By |2017-07-24T17:44:05+06:00July 24th, 2017|Categories: Uncategorized||

#include <bits/stdc++.h> using namespace std; string s1, s2, t; int main() { cin >> s1 >> s2 >> t; for(char c : t) putchar(c < 58 ? c : s2[s1.find(c < 91 ? c + 32 : c)] - (c < 91 ? 32 [...]

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (A) Unimodal Array Solution In C/C++

By |2017-07-24T17:41:42+06:00July 24th, 2017|Categories: C/C++, Programming||

#include<cstdio> using namespace std; int n,i,la,nw,fl,tp; int main(){ for(scanf("%d%d",&n,&la);++i<n;la=nw,fl=tp) if(scanf("%d",&nw),fl>(tp=(nw>la?0:(nw<la?2:1))))return puts("NO"); return puts("YES"); }