# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121621 | 2019-06-26T20:53:02 Z | yusufake | Game (IOI13_game) | C++ | 7361 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 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 | 640 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 | 2 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 484 KB | Output is correct |
12 | Correct | 2 ms | 432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 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 | 1155 ms | 27296 KB | Output is correct |
5 | Correct | 871 ms | 27744 KB | Output is correct |
6 | Correct | 1243 ms | 24608 KB | Output is correct |
7 | Correct | 1285 ms | 24348 KB | Output is correct |
8 | Correct | 804 ms | 15480 KB | Output is correct |
9 | Correct | 1312 ms | 24624 KB | Output is correct |
10 | Correct | 1172 ms | 24228 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 | 640 KB | Output is correct |
3 | Correct | 4 ms | 640 KB | Output is correct |
4 | Correct | 8 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 640 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 | 3 ms | 512 KB | Output is correct |
12 | Correct | 1660 ms | 12520 KB | Output is correct |
13 | Correct | 2511 ms | 6068 KB | Output is correct |
14 | Correct | 628 ms | 1104 KB | Output is correct |
15 | Correct | 2905 ms | 9008 KB | Output is correct |
16 | Correct | 666 ms | 14676 KB | Output is correct |
17 | Correct | 1807 ms | 10788 KB | Output is correct |
18 | Correct | 3014 ms | 14900 KB | Output is correct |
19 | Correct | 2560 ms | 15232 KB | Output is correct |
20 | Correct | 2469 ms | 14424 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 | 4 ms | 512 KB | Output is correct |
3 | Correct | 3 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 | 356 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 | 3 ms | 384 KB | Output is correct |
12 | Correct | 1115 ms | 27336 KB | Output is correct |
13 | Correct | 850 ms | 27592 KB | Output is correct |
14 | Correct | 1228 ms | 24436 KB | Output is correct |
15 | Correct | 1267 ms | 24252 KB | Output is correct |
16 | Correct | 798 ms | 15432 KB | Output is correct |
17 | Correct | 1289 ms | 24496 KB | Output is correct |
18 | Correct | 1171 ms | 24076 KB | Output is correct |
19 | Correct | 1643 ms | 12596 KB | Output is correct |
20 | Correct | 2494 ms | 6048 KB | Output is correct |
21 | Correct | 614 ms | 1016 KB | Output is correct |
22 | Correct | 2947 ms | 9016 KB | Output is correct |
23 | Correct | 673 ms | 14684 KB | Output is correct |
24 | Correct | 1692 ms | 10928 KB | Output is correct |
25 | Correct | 3089 ms | 14828 KB | Output is correct |
26 | Correct | 2663 ms | 15024 KB | Output is correct |
27 | Correct | 2405 ms | 14516 KB | Output is correct |
28 | Correct | 1237 ms | 157600 KB | Output is correct |
29 | Correct | 3059 ms | 175916 KB | Output is correct |
30 | Correct | 7218 ms | 120204 KB | Output is correct |
31 | Correct | 6875 ms | 91616 KB | Output is correct |
32 | Correct | 687 ms | 1176 KB | Output is correct |
33 | Correct | 992 ms | 2844 KB | Output is correct |
34 | Correct | 1549 ms | 173072 KB | Output is correct |
35 | Correct | 2196 ms | 88108 KB | Output is correct |
36 | Correct | 4290 ms | 173440 KB | Output is correct |
37 | Correct | 3388 ms | 173436 KB | Output is correct |
38 | Correct | 3251 ms | 172884 KB | Output is correct |
39 | Correct | 2915 ms | 133372 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 | 512 KB | Output is correct |
4 | Correct | 2 ms | 412 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 | 2 ms | 384 KB | Output is correct |
12 | Correct | 1130 ms | 27344 KB | Output is correct |
13 | Correct | 834 ms | 27512 KB | Output is correct |
14 | Correct | 1253 ms | 24688 KB | Output is correct |
15 | Correct | 1220 ms | 24264 KB | Output is correct |
16 | Correct | 797 ms | 15448 KB | Output is correct |
17 | Correct | 1272 ms | 24568 KB | Output is correct |
18 | Correct | 1140 ms | 24184 KB | Output is correct |
19 | Correct | 1691 ms | 12732 KB | Output is correct |
20 | Correct | 2503 ms | 6192 KB | Output is correct |
21 | Correct | 626 ms | 1072 KB | Output is correct |
22 | Correct | 2886 ms | 8916 KB | Output is correct |
23 | Correct | 677 ms | 14712 KB | Output is correct |
24 | Correct | 1914 ms | 10764 KB | Output is correct |
25 | Correct | 2973 ms | 14772 KB | Output is correct |
26 | Correct | 2512 ms | 14992 KB | Output is correct |
27 | Correct | 2366 ms | 14532 KB | Output is correct |
28 | Correct | 1149 ms | 157520 KB | Output is correct |
29 | Correct | 2901 ms | 175804 KB | Output is correct |
30 | Correct | 7361 ms | 119976 KB | Output is correct |
31 | Correct | 6593 ms | 91652 KB | Output is correct |
32 | Correct | 676 ms | 1160 KB | Output is correct |
33 | Correct | 919 ms | 2716 KB | Output is correct |
34 | Correct | 1523 ms | 172888 KB | Output is correct |
35 | Correct | 2199 ms | 88000 KB | Output is correct |
36 | Correct | 4434 ms | 173488 KB | Output is correct |
37 | Correct | 3510 ms | 173520 KB | Output is correct |
38 | Correct | 3571 ms | 172848 KB | Output is correct |
39 | Runtime error | 1209 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |