# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121636 | 2019-06-26T21:18:46 Z | yusufake | Game (IOI13_game) | C++17 | 7298 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 | 5 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 | 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 | 552 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 | 384 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 | 1091 ms | 30140 KB | Output is correct |
5 | Correct | 837 ms | 30332 KB | Output is correct |
6 | Correct | 1271 ms | 27480 KB | Output is correct |
7 | Correct | 1283 ms | 27420 KB | Output is correct |
8 | Correct | 798 ms | 18720 KB | Output is correct |
9 | Correct | 1273 ms | 27656 KB | Output is correct |
10 | Correct | 1191 ms | 27420 KB | Output is correct |
11 | Correct | 2 ms | 300 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 | 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 | 640 KB | Output is correct |
10 | Correct | 3 ms | 428 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 1682 ms | 15596 KB | Output is correct |
13 | Correct | 2490 ms | 8692 KB | Output is correct |
14 | Correct | 619 ms | 3832 KB | Output is correct |
15 | Correct | 2876 ms | 11816 KB | Output is correct |
16 | Correct | 678 ms | 17512 KB | Output is correct |
17 | Correct | 1842 ms | 13432 KB | Output is correct |
18 | Correct | 2972 ms | 16808 KB | Output is correct |
19 | Correct | 2542 ms | 16852 KB | Output is correct |
20 | Correct | 2402 ms | 16400 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 | 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 | 3 ms | 640 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 1136 ms | 29164 KB | Output is correct |
13 | Correct | 864 ms | 29440 KB | Output is correct |
14 | Correct | 1319 ms | 26408 KB | Output is correct |
15 | Correct | 1306 ms | 26124 KB | Output is correct |
16 | Correct | 848 ms | 17372 KB | Output is correct |
17 | Correct | 1320 ms | 25916 KB | Output is correct |
18 | Correct | 1177 ms | 25184 KB | Output is correct |
19 | Correct | 1685 ms | 13760 KB | Output is correct |
20 | Correct | 2668 ms | 7248 KB | Output is correct |
21 | Correct | 633 ms | 2344 KB | Output is correct |
22 | Correct | 2981 ms | 10212 KB | Output is correct |
23 | Correct | 670 ms | 15864 KB | Output is correct |
24 | Correct | 1689 ms | 12116 KB | Output is correct |
25 | Correct | 2978 ms | 16152 KB | Output is correct |
26 | Correct | 2406 ms | 16400 KB | Output is correct |
27 | Correct | 2333 ms | 15544 KB | Output is correct |
28 | Correct | 1179 ms | 159076 KB | Output is correct |
29 | Correct | 2951 ms | 177268 KB | Output is correct |
30 | Correct | 7298 ms | 121636 KB | Output is correct |
31 | Correct | 6829 ms | 93332 KB | Output is correct |
32 | Correct | 690 ms | 2820 KB | Output is correct |
33 | Correct | 942 ms | 4344 KB | Output is correct |
34 | Correct | 1577 ms | 174612 KB | Output is correct |
35 | Correct | 2548 ms | 89640 KB | Output is correct |
36 | Correct | 4480 ms | 174624 KB | Output is correct |
37 | Correct | 3678 ms | 174072 KB | Output is correct |
38 | Correct | 3406 ms | 173180 KB | Output is correct |
39 | Correct | 2828 ms | 133252 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 | 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 | 11 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 | 512 KB | Output is correct |
12 | Correct | 1120 ms | 27312 KB | Output is correct |
13 | Correct | 834 ms | 27768 KB | Output is correct |
14 | Correct | 1256 ms | 24696 KB | Output is correct |
15 | Correct | 1233 ms | 24272 KB | Output is correct |
16 | Correct | 777 ms | 15452 KB | Output is correct |
17 | Correct | 1243 ms | 24692 KB | Output is correct |
18 | Correct | 1172 ms | 24088 KB | Output is correct |
19 | Correct | 1730 ms | 12700 KB | Output is correct |
20 | Correct | 2568 ms | 6128 KB | Output is correct |
21 | Correct | 635 ms | 1252 KB | Output is correct |
22 | Correct | 2950 ms | 9056 KB | Output is correct |
23 | Correct | 708 ms | 14668 KB | Output is correct |
24 | Correct | 1819 ms | 10996 KB | Output is correct |
25 | Correct | 3020 ms | 14816 KB | Output is correct |
26 | Correct | 2646 ms | 15184 KB | Output is correct |
27 | Correct | 2355 ms | 14464 KB | Output is correct |
28 | Correct | 1180 ms | 157788 KB | Output is correct |
29 | Correct | 2799 ms | 175876 KB | Output is correct |
30 | Correct | 7278 ms | 120064 KB | Output is correct |
31 | Correct | 6819 ms | 91660 KB | Output is correct |
32 | Correct | 692 ms | 1428 KB | Output is correct |
33 | Correct | 935 ms | 2820 KB | Output is correct |
34 | Correct | 1588 ms | 173068 KB | Output is correct |
35 | Correct | 2255 ms | 88124 KB | Output is correct |
36 | Correct | 4140 ms | 173500 KB | Output is correct |
37 | Correct | 3290 ms | 173480 KB | Output is correct |
38 | Correct | 3298 ms | 172788 KB | Output is correct |
39 | Runtime error | 1608 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |