Submission #220360

#TimeUsernameProblemLanguageResultExecution timeMemory
220360giorgikobHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
int jump[1000000]; //int beg[1000000]; int X[1000000]; int Y[1000000]; int N; int get_idx(int l,int r){ if(l == r){ return l; } int mid = l+r; mid >>= 1; int x = get_idx(l,mid); int y = get_idx(mid+1,r); ll cnt = 1; for(int i = x+1; i <= y; i++){ if(jump[i] != -1){ i = jump[i]; continue; } cnt *= X[i]; if(cnt > Y[x]){ break; } } return (cnt > Y[x]) ? y : x; } int calc(int pos){ ll cnt = 1; for(int i = 0; i < pos; i++){ cnt *= X[i]; cnt %= mod; } cnt *= Y[pos]; cnt %= mod; return (int)cnt; } void go(){ for(int i = 0; i < N; i++){ if(X[i] == 1){ int l = i; while(i+1 < N && X[i+1] == 0) i++; while(l != i) jump[l] = i, l++; } } } int init(int n, int x[], int y[]) { N = n; for(int i = 0; i < N; i++){ jump[i] = -1; //beg[i] = -1; X[i] = x[i]; Y[i] = y[i]; } go(); int idx = get_idx(0,N); return calc(idx); } int updateX(int pos, int val) { X[pos] = val; go(); int idx = get_idx(0,N); return calc(idx); } int updateY(int pos, int val) { Y[pos] = val; int idx = get_idx(0,N); return calc(idx); }

Compilation message (stderr)

horses.cpp: In function 'int get_idx(int, int)':
horses.cpp:19:9: error: 'll' was not declared in this scope
         ll cnt = 1;
         ^~
horses.cpp:19:9: note: suggested alternative: 'l'
         ll cnt = 1;
         ^~
         l
horses.cpp:25:17: error: 'cnt' was not declared in this scope
                 cnt *= X[i];
                 ^~~
horses.cpp:25:17: note: suggested alternative: 'int'
                 cnt *= X[i];
                 ^~~
                 int
horses.cpp:31:17: error: 'cnt' was not declared in this scope
         return (cnt > Y[x]) ? y : x;
                 ^~~
horses.cpp:31:17: note: suggested alternative: 'int'
         return (cnt > Y[x]) ? y : x;
                 ^~~
                 int
horses.cpp: In function 'int calc(int)':
horses.cpp:35:9: error: 'll' was not declared in this scope
         ll cnt = 1;
         ^~
horses.cpp:37:17: error: 'cnt' was not declared in this scope
                 cnt *= X[i];
                 ^~~
horses.cpp:37:17: note: suggested alternative: 'int'
                 cnt *= X[i];
                 ^~~
                 int
horses.cpp:38:24: error: 'mod' was not declared in this scope
                 cnt %= mod;
                        ^~~
horses.cpp:40:9: error: 'cnt' was not declared in this scope
         cnt *= Y[pos];
         ^~~
horses.cpp:40:9: note: suggested alternative: 'int'
         cnt *= Y[pos];
         ^~~
         int
horses.cpp:41:16: error: 'mod' was not declared in this scope
         cnt %= mod;
                ^~~