0_0_22048212_26777.cpp: In function 'int main()':
0_0_22048212_26777.cpp:3:564: error: expected '}' at end of input
const int maxn = 1000005;int n;int a[2*maxn];int b[maxn];int g[2*maxn];int getint() { char c = getchar(); if(c == EOF) return -1; int x = 0; while(c != ' ' && c != '\n') { x = c - '0' + x*10; c = getchar(); } return x;}void in() { for(int i = 1; i <= n; i++) a[i] = getint(); for(int i = n+1; i <= 2*n; i++) a[i] = a[i-n]; for(int i = 1; i <= n; i++) b[i] = getint(); for(int i = 1; i <= n; i++) g[i] = a[i] - b[i]; for(int i = n+1; i <= 2*n; i++) g[i] = g[i-n];}int main() {// freopen("in.txt", "r", stdin); while(true) { n = getint(); if(n == -1) break; in(); int i = 1, j = 1, sum = 0, card = 0, ans = 0; while(i <= n && j <= 2*n) { int t = 0; while((j-i+1) <= n && sum >= 0){ sum += g[j]; t += a[j++]; } if(t > card){ ans = i-1; card = t; } sum -= g[i]; t -= a[i++]; } printf("%d\n", ans); } return 0;}
^
|