# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121608 | 2019-06-26T20:32:38 Z | yusufake | Game (IOI13_game) | C++ | 7321 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 * 900; 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 | 1 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 | 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 | 4 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 | 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 | 1126 ms | 29800 KB | Output is correct |
5 | Correct | 872 ms | 29996 KB | Output is correct |
6 | Correct | 1314 ms | 26764 KB | Output is correct |
7 | Correct | 1302 ms | 26824 KB | Output is correct |
8 | Correct | 835 ms | 17988 KB | Output is correct |
9 | Correct | 1331 ms | 26900 KB | Output is correct |
10 | Correct | 1235 ms | 26488 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 | 2 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 | 0 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 | 4 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 | 1693 ms | 15040 KB | Output is correct |
13 | Correct | 2514 ms | 8580 KB | Output is correct |
14 | Correct | 644 ms | 3540 KB | Output is correct |
15 | Correct | 2936 ms | 11368 KB | Output is correct |
16 | Correct | 696 ms | 17192 KB | Output is correct |
17 | Correct | 1772 ms | 13144 KB | Output is correct |
18 | Correct | 2943 ms | 17320 KB | Output is correct |
19 | Correct | 2634 ms | 17384 KB | Output is correct |
20 | Correct | 2402 ms | 16552 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 | 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 | 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 | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 1154 ms | 29772 KB | Output is correct |
13 | Correct | 928 ms | 29972 KB | Output is correct |
14 | Correct | 1207 ms | 26776 KB | Output is correct |
15 | Correct | 1242 ms | 26716 KB | Output is correct |
16 | Correct | 808 ms | 17656 KB | Output is correct |
17 | Correct | 1338 ms | 26744 KB | Output is correct |
18 | Correct | 1173 ms | 26424 KB | Output is correct |
19 | Correct | 1746 ms | 14964 KB | Output is correct |
20 | Correct | 2505 ms | 8328 KB | Output is correct |
21 | Correct | 620 ms | 3320 KB | Output is correct |
22 | Correct | 2963 ms | 11204 KB | Output is correct |
23 | Correct | 671 ms | 16840 KB | Output is correct |
24 | Correct | 1723 ms | 13140 KB | Output is correct |
25 | Correct | 2860 ms | 17068 KB | Output is correct |
26 | Correct | 2411 ms | 17280 KB | Output is correct |
27 | Correct | 2230 ms | 16572 KB | Output is correct |
28 | Correct | 1187 ms | 159576 KB | Output is correct |
29 | Correct | 2937 ms | 177868 KB | Output is correct |
30 | Correct | 7296 ms | 121780 KB | Output is correct |
31 | Correct | 6620 ms | 93740 KB | Output is correct |
32 | Correct | 687 ms | 3192 KB | Output is correct |
33 | Correct | 912 ms | 4876 KB | Output is correct |
34 | Correct | 1549 ms | 175064 KB | Output is correct |
35 | Correct | 2220 ms | 90072 KB | Output is correct |
36 | Correct | 4335 ms | 175376 KB | Output is correct |
37 | Correct | 3378 ms | 175408 KB | Output is correct |
38 | Correct | 3288 ms | 174872 KB | Output is correct |
39 | Correct | 2934 ms | 135312 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 | 256 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 | 4 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 | 1154 ms | 29584 KB | Output is correct |
13 | Correct | 827 ms | 29888 KB | Output is correct |
14 | Correct | 1278 ms | 26744 KB | Output is correct |
15 | Correct | 1252 ms | 26520 KB | Output is correct |
16 | Correct | 762 ms | 17812 KB | Output is correct |
17 | Correct | 1288 ms | 26756 KB | Output is correct |
18 | Correct | 1227 ms | 26248 KB | Output is correct |
19 | Correct | 1731 ms | 14728 KB | Output is correct |
20 | Correct | 2498 ms | 8208 KB | Output is correct |
21 | Correct | 619 ms | 3200 KB | Output is correct |
22 | Correct | 2881 ms | 11000 KB | Output is correct |
23 | Correct | 684 ms | 16668 KB | Output is correct |
24 | Correct | 1800 ms | 12872 KB | Output is correct |
25 | Correct | 2873 ms | 17072 KB | Output is correct |
26 | Correct | 2499 ms | 17168 KB | Output is correct |
27 | Correct | 2254 ms | 16652 KB | Output is correct |
28 | Correct | 1130 ms | 159516 KB | Output is correct |
29 | Correct | 2785 ms | 177436 KB | Output is correct |
30 | Correct | 7321 ms | 121556 KB | Output is correct |
31 | Correct | 6596 ms | 93604 KB | Output is correct |
32 | Correct | 683 ms | 3068 KB | Output is correct |
33 | Correct | 904 ms | 4508 KB | Output is correct |
34 | Correct | 1534 ms | 174864 KB | Output is correct |
35 | Correct | 2334 ms | 89984 KB | Output is correct |
36 | Correct | 4212 ms | 175312 KB | Output is correct |
37 | Correct | 3463 ms | 175136 KB | Output is correct |
38 | Correct | 3462 ms | 174584 KB | Output is correct |
39 | Runtime error | 1151 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |