# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121635 | 2019-06-26T21:17:12 Z | yusufake | Game (IOI13_game) | C++11 | 7408 ms | 256000 KB |
#include<bits/stdc++.h> #include "game.h" using namespace std; #define _ int v, int tl, int tr #define tm (tl+tr >> 1) #define sol L[v],tl,tm #define sag R[v],tm+1,tr #define mp make_pair #define pb push_back #define st first #define nd second typedef long long ll; typedef pair < int , int > pp; const int mod = 1e9 + 7; const int N = 22000 * 61 * 61; int Y[N],L[N],R[N],id=1; ll s[N]; // 0 is empty node // s[0] should be ineffective element // Y[0], L[0], and R[0] should be 0 // 1 is the root of the -x axis segment tree // Y[v] is the root of the segment tree of the interval that corresponds to node 'v' in -x axis segment tree ll gcd(ll u, ll v) { ll r; while (v != 0) { r = u % v; u = v; v = r; } return u; } ll qry_y(_, int ly, int ry) { if(ly > tr || ry < tl || !v) return 0; if (ly <= tl && tr <= ry) return s[v]; return gcd(qry_y(sol,ly,ry) , qry_y(sag,ly,ry)); } ll qry_x(_, int lx, int rx, int ly, int ry) { if(lx > tr || rx < tl) return 0; if (lx <= tl && tr <= rx) return qry_y(Y[v], 0, mod, ly, ry); return gcd(qry_x(sol,lx,rx,ly,ry) , qry_x(sag,lx,rx,ly,ry)); } void up_y(_, int posy, int r1, int r2, ll t){ if(id == 22000 * 61 * 61 - 5) while(1); if(tl == tr){ s[v] = t == -1 ? gcd(s[r1] , s[r2]) : t; return; } if(posy > tm) { if(!R[v]) R[v] = ++id; up_y(sag,posy,R[r1],R[r2],t); } else { if(!L[v]) L[v] = ++id; up_y(sol,posy,L[r1],L[r2],t); } s[v] = gcd(s[ L[v] ] , s[ R[v] ]); } void up_x(_, int posx, int posy, ll t){ if(id == 22000 * 61 * 61 - 5) while(1); if(tl < tr){ if(posx > tm) { if(!R[v]) R[v] = ++id; up_x(sag,posx,posy,t); } else { if(!L[v]) L[v] = ++id; up_x(sol,posx,posy,t); } } if(!Y[v]) Y[v] = ++id; up_y(Y[v],0,mod,posy,Y[ L[v] ],Y[ R[v] ],(tl==tr?t:-1)); } void update(int posx, int posy, ll t){ up_x(1,0,mod,posx,posy,t); } ll calculate(int lx, int ly, int rx, int ry){ return qry_x(1,0,mod,lx,rx,ly,ry); } void init(int a, int b) {}
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 512 KB | Output is correct |
3 | Correct | 4 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 512 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 356 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 1081 ms | 29504 KB | Output is correct |
5 | Correct | 835 ms | 29360 KB | Output is correct |
6 | Correct | 1265 ms | 26808 KB | Output is correct |
7 | Correct | 1290 ms | 26224 KB | Output is correct |
8 | Correct | 862 ms | 17068 KB | Output is correct |
9 | Correct | 1342 ms | 26380 KB | Output is correct |
10 | Correct | 1166 ms | 25948 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 592 KB | Output is correct |
3 | Correct | 4 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 512 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 560 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 1693 ms | 14344 KB | Output is correct |
13 | Correct | 2539 ms | 8016 KB | Output is correct |
14 | Correct | 634 ms | 3520 KB | Output is correct |
15 | Correct | 2898 ms | 10836 KB | Output is correct |
16 | Correct | 675 ms | 16372 KB | Output is correct |
17 | Correct | 1850 ms | 13196 KB | Output is correct |
18 | Correct | 2936 ms | 18492 KB | Output is correct |
19 | Correct | 2559 ms | 18536 KB | Output is correct |
20 | Correct | 2301 ms | 17936 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 612 KB | Output is correct |
3 | Correct | 4 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 1106 ms | 29872 KB | Output is correct |
13 | Correct | 836 ms | 30028 KB | Output is correct |
14 | Correct | 1274 ms | 26852 KB | Output is correct |
15 | Correct | 1307 ms | 26684 KB | Output is correct |
16 | Correct | 827 ms | 17720 KB | Output is correct |
17 | Correct | 1330 ms | 27248 KB | Output is correct |
18 | Correct | 1186 ms | 27124 KB | Output is correct |
19 | Correct | 1709 ms | 15544 KB | Output is correct |
20 | Correct | 2521 ms | 8944 KB | Output is correct |
21 | Correct | 700 ms | 4168 KB | Output is correct |
22 | Correct | 3008 ms | 11744 KB | Output is correct |
23 | Correct | 762 ms | 17520 KB | Output is correct |
24 | Correct | 1859 ms | 14088 KB | Output is correct |
25 | Correct | 2894 ms | 18540 KB | Output is correct |
26 | Correct | 2622 ms | 18552 KB | Output is correct |
27 | Correct | 2447 ms | 18112 KB | Output is correct |
28 | Correct | 1181 ms | 161580 KB | Output is correct |
29 | Correct | 3027 ms | 179108 KB | Output is correct |
30 | Correct | 7408 ms | 122544 KB | Output is correct |
31 | Correct | 6711 ms | 93688 KB | Output is correct |
32 | Correct | 691 ms | 3164 KB | Output is correct |
33 | Correct | 925 ms | 4724 KB | Output is correct |
34 | Correct | 1553 ms | 174524 KB | Output is correct |
35 | Correct | 2156 ms | 89488 KB | Output is correct |
36 | Correct | 4257 ms | 175020 KB | Output is correct |
37 | Correct | 3354 ms | 175192 KB | Output is correct |
38 | Correct | 3430 ms | 174580 KB | Output is correct |
39 | Correct | 2749 ms | 135472 KB | Output is correct |
40 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 640 KB | Output is correct |
3 | Correct | 4 ms | 640 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 512 KB | Output is correct |
7 | Correct | 2 ms | 428 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 1103 ms | 28708 KB | Output is correct |
13 | Correct | 848 ms | 28884 KB | Output is correct |
14 | Correct | 1274 ms | 25980 KB | Output is correct |
15 | Correct | 1256 ms | 25580 KB | Output is correct |
16 | Correct | 799 ms | 16752 KB | Output is correct |
17 | Correct | 1277 ms | 25848 KB | Output is correct |
18 | Correct | 1216 ms | 24928 KB | Output is correct |
19 | Correct | 1684 ms | 13328 KB | Output is correct |
20 | Correct | 2547 ms | 6812 KB | Output is correct |
21 | Correct | 652 ms | 1896 KB | Output is correct |
22 | Correct | 2923 ms | 9852 KB | Output is correct |
23 | Correct | 666 ms | 15304 KB | Output is correct |
24 | Correct | 1721 ms | 11664 KB | Output is correct |
25 | Correct | 2860 ms | 15624 KB | Output is correct |
26 | Correct | 2444 ms | 15664 KB | Output is correct |
27 | Correct | 2435 ms | 15060 KB | Output is correct |
28 | Correct | 1157 ms | 158688 KB | Output is correct |
29 | Correct | 2846 ms | 176824 KB | Output is correct |
30 | Correct | 7405 ms | 121044 KB | Output is correct |
31 | Correct | 6651 ms | 92788 KB | Output is correct |
32 | Correct | 683 ms | 2276 KB | Output is correct |
33 | Correct | 906 ms | 3808 KB | Output is correct |
34 | Correct | 1540 ms | 173608 KB | Output is correct |
35 | Correct | 2126 ms | 89096 KB | Output is correct |
36 | Correct | 4433 ms | 174352 KB | Output is correct |
37 | Correct | 3575 ms | 173928 KB | Output is correct |
38 | Correct | 3612 ms | 173028 KB | Output is correct |
39 | Runtime error | 1184 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |