problem: (G) New Roads Solution in C/C++ Archive

Codeforces Round #386 (Div. 2), problem: (G) New Roads Solution in C/C++

Codeforces Round #386 (Div. 2), problem: (G) New Roads Solution in C/C++

Codeforces Round #386 (Div. 2), problem: (G) New Roads Solution in C/C++ #include<stdio.h> #include<stdlib.h> typedef unsigned u; u D,H,P,A; int main() { u n,d,x,i=-1,j,k,mi=0,ma=1; for(scanf("%u%u%u",&n,&d,&x);++i<d;)scanf("%u",D+i); for(i=d;i--;ma+=D-1)if(D>D)mi+=D-D; if(x<mi||x>ma){printf("-1\n");return 0;} for(A=2;i++<d;)A=A+D; for(i=1;++i<A;)P=1; for(i=0;++i<d;) { k=D-1; if(k>D-1)k=D-1; j=ma-x; …