# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121594 | 2019-06-26T20:10:45 Z | yusufake | Game (IOI13_game) | C++ | 7436 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 * 500; int Y[N],L[N],R[N],id=1; ll s[N]; // 0 is empty node // s[0] should be ineffective element // 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(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(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 | 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 | 512 KB | Output is correct |
10 | Correct | 3 ms | 428 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 2 ms | 384 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 | 1146 ms | 31980 KB | Output is correct |
5 | Correct | 849 ms | 31584 KB | Output is correct |
6 | Correct | 1279 ms | 29380 KB | Output is correct |
7 | Correct | 1361 ms | 28908 KB | Output is correct |
8 | Correct | 830 ms | 19672 KB | Output is correct |
9 | Correct | 1336 ms | 29260 KB | Output is correct |
10 | Correct | 1150 ms | 28764 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 | 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 | 4 ms | 632 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 1673 ms | 16888 KB | Output is correct |
13 | Correct | 2460 ms | 10100 KB | Output is correct |
14 | Correct | 633 ms | 5800 KB | Output is correct |
15 | Correct | 2904 ms | 13336 KB | Output is correct |
16 | Correct | 682 ms | 18884 KB | Output is correct |
17 | Correct | 1785 ms | 15668 KB | Output is correct |
18 | Correct | 2972 ms | 20256 KB | Output is correct |
19 | Correct | 2681 ms | 20272 KB | Output is correct |
20 | Correct | 2430 ms | 19928 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 | 3 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 | 1075 ms | 31968 KB | Output is correct |
13 | Correct | 817 ms | 31636 KB | Output is correct |
14 | Correct | 1232 ms | 29240 KB | Output is correct |
15 | Correct | 1229 ms | 29040 KB | Output is correct |
16 | Correct | 780 ms | 19776 KB | Output is correct |
17 | Correct | 1264 ms | 29240 KB | Output is correct |
18 | Correct | 1181 ms | 28792 KB | Output is correct |
19 | Correct | 1693 ms | 16932 KB | Output is correct |
20 | Correct | 2513 ms | 10032 KB | Output is correct |
21 | Correct | 622 ms | 6008 KB | Output is correct |
22 | Correct | 2893 ms | 13504 KB | Output is correct |
23 | Correct | 688 ms | 18808 KB | Output is correct |
24 | Correct | 1780 ms | 15636 KB | Output is correct |
25 | Correct | 3028 ms | 20276 KB | Output is correct |
26 | Correct | 2676 ms | 20452 KB | Output is correct |
27 | Correct | 2421 ms | 19812 KB | Output is correct |
28 | Correct | 1188 ms | 168176 KB | Output is correct |
29 | Correct | 2958 ms | 185836 KB | Output is correct |
30 | Correct | 7436 ms | 126768 KB | Output is correct |
31 | Correct | 6841 ms | 98892 KB | Output is correct |
32 | Correct | 725 ms | 10504 KB | Output is correct |
33 | Correct | 895 ms | 12088 KB | Output is correct |
34 | Correct | 1515 ms | 179812 KB | Output is correct |
35 | Correct | 2315 ms | 97952 KB | Output is correct |
36 | Correct | 4077 ms | 184064 KB | Output is correct |
37 | Correct | 3328 ms | 184172 KB | Output is correct |
38 | Correct | 3391 ms | 183392 KB | Output is correct |
39 | Correct | 2877 ms | 143544 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 | 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 | 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 | 384 KB | Output is correct |
12 | Correct | 1118 ms | 31792 KB | Output is correct |
13 | Correct | 855 ms | 31712 KB | Output is correct |
14 | Correct | 1337 ms | 29320 KB | Output is correct |
15 | Correct | 1252 ms | 29048 KB | Output is correct |
16 | Correct | 798 ms | 19764 KB | Output is correct |
17 | Correct | 1294 ms | 29188 KB | Output is correct |
18 | Correct | 1149 ms | 28716 KB | Output is correct |
19 | Correct | 1678 ms | 16728 KB | Output is correct |
20 | Correct | 2490 ms | 10144 KB | Output is correct |
21 | Correct | 620 ms | 5868 KB | Output is correct |
22 | Correct | 2937 ms | 13428 KB | Output is correct |
23 | Correct | 671 ms | 18860 KB | Output is correct |
24 | Correct | 1754 ms | 15772 KB | Output is correct |
25 | Correct | 2828 ms | 20192 KB | Output is correct |
26 | Correct | 2544 ms | 20476 KB | Output is correct |
27 | Correct | 2415 ms | 19716 KB | Output is correct |
28 | Correct | 1688 ms | 168168 KB | Output is correct |
29 | Correct | 3554 ms | 185896 KB | Output is correct |
30 | Correct | 7338 ms | 126844 KB | Output is correct |
31 | Correct | 6701 ms | 98772 KB | Output is correct |
32 | Correct | 778 ms | 10564 KB | Output is correct |
33 | Correct | 1259 ms | 11892 KB | Output is correct |
34 | Correct | 2225 ms | 179648 KB | Output is correct |
35 | Correct | 2211 ms | 97788 KB | Output is correct |
36 | Correct | 4560 ms | 184048 KB | Output is correct |
37 | Correct | 3739 ms | 183972 KB | Output is correct |
38 | Correct | 3551 ms | 183512 KB | Output is correct |
39 | Runtime error | 2435 ms | 256000 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |