## Codeforces Round #429 (Div. 2), problem: (E) On the Bench Solution In C/C++

By |2017-08-21T13:19:00+06:00August 21st, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> #define ll long long int #define LL long long int #define ULL unsigned long long int #define sf(a) scanf("%d",&a) #define sl(a) scanf("%lld",&a) #define fr first #define sc second #define pii pair<int,int> #define pll pair<LL,LL> #define vi vector<int> #define vll vector<LL> #define vpii vector<pii> [...]

## Codeforces Round #429 (Div. 2), problem: (D) Leha and another game about graph Solution In C/C++

By |2017-08-21T13:17:40+06:00August 21st, 2017|Categories: C/C++, Programming||

#include<cstdio> using namespace std; const int MAXN = 300000+5; const int MAXE = MAXN*2; int to[MAXE], nxt[MAXE], head[MAXN], ne; void addEdge(int f, int t) { to[++ne] = t; nxt[ne] = head[f]; head[f] = ne; } int n, m; int d[MAXN]; bool vis[MAXN]; bool mark[MAXE]; [...]

## Codeforces Round #429 (Div. 2), problem: (C) Leha and Function Solution In C/C++

By |2017-08-21T13:16:20+06:00August 21st, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> using namespace std; int main(){ std::ios::sync_with_stdio(false); int m; cin>>m; int a[m],b[m]; for(int i=0;i<m;i++) cin>>a[i]; vector<pair<int,int> >br(m); for(int i=0;i<m;i++){ cin>>b[i]; br[i]=make_pair(b[i],i); } sort(a,a+m); int ans[m]; sort(br.begin(),br.end()); reverse(br.begin(),br.end()); for(int i=0;i<m;i++) ans[br[i].second]=a[i]; for(int i=0;i<m;i++) cout<<ans[i]<<" "; return 0; }

## Codeforces Round #429 (Div. 2), problem: (B) Godsend Solution In C/C++

By |2017-08-21T13:15:03+06:00August 21st, 2017|Categories: C/C++, Programming||

#include<cstdio> int main() { int n;int t;scanf("%d",&n); for(int i=1;i<=n;i++) {scanf("%d",&t); if(t%2) { printf("First"); return 0; } } printf("Second"); return 0; }

## Codeforces Round #429 (Div. 2), problem: (A) Generous Kefa Solution in C/C++

By |2017-08-21T13:13:44+06:00August 21st, 2017|Categories: C/C++, Programming||

#include<iostream> using namespace std; int i,j,n,k,a[26]; string s; main(){ for(cin>>n>>k>>s;i<s.size();)a[s[i++]-'a']++; for(i=0;j<26;)a[j++]>k?i=1:0; cout<<(i?"NO\n":"YES\n"); }