# Codeforces Round #388 (Div. 2)

/Tag: Codeforces Round #388 (Div. 2)

## Codeforces Round #388 (Div. 2), problem: (E) Inversions After Shuffle Solution in C/C++

By |2017-04-07T22:11:44+06:00January 6th, 2017|Categories: C/C++, Programming||

Codeforces Round #388 (Div. 2), problem: (E) Inversions After Shuffle Solution in C/C++   #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100000 /* Fenwick tree */ void update(long long *tt, int i, int n, int x) { while (i < n) { tt[i] [...]

## Codeforces Round #388 (Div. 2), problem: (D) Leaving Auction Solution in C/C++

By |2017-04-07T22:11:44+06:00January 6th, 2017|Categories: C/C++, Programming||

Codeforces Round #388 (Div. 2), problem: (D) Leaving Auction Solution in C/C++   #include<stdio.h> #include<stdlib.h> typedef unsigned u; u *G[222222],Ga[222222],Gi[222222],M[222222],P[222222],S[222222],V[222222]; int F(const void*x,const void*y) { if(M[*(u*)x]>M[*(u*)y])return 1; if(M[*(u*)x]<M[*(u*)y])return-1; if(*(u*)x<*(u*)y)return 1; if(*(u*)x>*(u*)y)return-1; return 0; } int main() { u n,i=-1,j,k,q=0,Q,lo,hi,mi; for(scanf("%u",&n);++i<n;S[i]=i) { scanf("%u%u",&j,&k);liar:; if(Ga[j]==Gi[j]) { [...]

## Codeforces Round #388 (Div. 2), problem: (C) Voting Solution in C/C++

By |2017-04-07T22:11:45+06:00January 6th, 2017|Categories: C/C++, Programming||

Codeforces Round #388 (Div. 2), problem: (C) Voting Solution in C/C++   #include<stdio.h> typedef unsigned u; char S[222222],D[222222]; int main() { u l,i,ds,rs,dq,rq; ds=rs=dq=rq=0; scanf("%u%s",&l,S); for(i=-1;++i<l;) { if(S[i]=='D')++ds; if(S[i]=='R')++rs; } for(;ds&&rs;) { for(i=-1;++i<l;)if(!D[i]) { if(S[i]=='D') { if(dq){--dq;--ds;D[i]=1;continue;} ++rq; } if(S[i]=='R') { if(rq){--rq;--rs;D[i]=1;continue;} ++dq; } [...]

## Codeforces Round #388 (Div. 2), problem: (B) Parallelogram is Back Solution in C/C++

By |2017-04-07T22:11:45+06:00January 6th, 2017|Categories: C/C++, Programming||

Codeforces Round #388 (Div. 2), problem: (B) Parallelogram is Back Solution in C/C++     int main() { int x1,y1,x2,y2,x3,y3; scanf("%d%d\n%d%d\n%d%d",&x1,&y1,&x2,&y2,&x3,&y3); printf("3\n%d %d\n%d %d\n%d %d",x1+x2-x3,y1+y2-y3,x2+x3-x1,y2+y3-y1,x3+x1-x2,y3+y1-y2); return 0; }

## Codeforces Round #388 (Div. 2), problem: (A) Bachgold Problem Solution in C/C++

By |2017-04-07T22:11:45+06:00January 6th, 2017|Categories: C/C++, Programming||

Codeforces Round #388 (Div. 2), problem: (A) Bachgold Problem Solution in C/C++   #include<stdio.h> typedef unsigned u; int main() { u n; scanf("%u",&n); printf("%u\n",n>>1); if(n&1){printf("3 ");n-=3;} while(n){printf("2 ");n-=2;} return 0; }