# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
121638 | 2019-06-26T21:24:39 Z | yusufake | 게임 (IOI13_game) | C++ | 7509 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; static int Y[N],L[N],R[N],id=1; static 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
# | 결과 | 실행 시간 | 메모리 | 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 | 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 | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 1089 ms | 27392 KB | Output is correct |
5 | Correct | 849 ms | 27548 KB | Output is correct |
6 | Correct | 1242 ms | 24648 KB | Output is correct |
7 | Correct | 1289 ms | 24452 KB | Output is correct |
8 | Correct | 796 ms | 15428 KB | Output is correct |
9 | Correct | 1301 ms | 24636 KB | Output is correct |
10 | Correct | 1189 ms | 24044 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 640 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 | 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 | 1677 ms | 12684 KB | Output is correct |
13 | Correct | 2545 ms | 6124 KB | Output is correct |
14 | Correct | 636 ms | 1144 KB | Output is correct |
15 | Correct | 2854 ms | 8840 KB | Output is correct |
16 | Correct | 671 ms | 14552 KB | Output is correct |
17 | Correct | 1808 ms | 10792 KB | Output is correct |
18 | Correct | 3011 ms | 14976 KB | Output is correct |
19 | Correct | 2608 ms | 15008 KB | Output is correct |
20 | Correct | 2452 ms | 14352 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 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 | 1140 ms | 27332 KB | Output is correct |
13 | Correct | 845 ms | 27664 KB | Output is correct |
14 | Correct | 1298 ms | 24460 KB | Output is correct |
15 | Correct | 1318 ms | 24268 KB | Output is correct |
16 | Correct | 819 ms | 15444 KB | Output is correct |
17 | Correct | 1362 ms | 24456 KB | Output is correct |
18 | Correct | 1215 ms | 24008 KB | Output is correct |
19 | Correct | 1700 ms | 12572 KB | Output is correct |
20 | Correct | 2496 ms | 6016 KB | Output is correct |
21 | Correct | 621 ms | 1168 KB | Output is correct |
22 | Correct | 3002 ms | 9040 KB | Output is correct |
23 | Correct | 698 ms | 14552 KB | Output is correct |
24 | Correct | 1798 ms | 10920 KB | Output is correct |
25 | Correct | 3084 ms | 14860 KB | Output is correct |
26 | Correct | 2607 ms | 14980 KB | Output is correct |
27 | Correct | 2476 ms | 14488 KB | Output is correct |
28 | Correct | 1155 ms | 157776 KB | Output is correct |
29 | Correct | 2936 ms | 175848 KB | Output is correct |
30 | Correct | 7509 ms | 119976 KB | Output is correct |
31 | Correct | 6775 ms | 91624 KB | Output is correct |
32 | Correct | 697 ms | 1268 KB | Output is correct |
33 | Correct | 917 ms | 2848 KB | Output is correct |
34 | Correct | 1544 ms | 172976 KB | Output is correct |
35 | Correct | 2093 ms | 88276 KB | Output is correct |
36 | Correct | 4006 ms | 173480 KB | Output is correct |
37 | Correct | 3307 ms | 173452 KB | Output is correct |
38 | Correct | 3286 ms | 172900 KB | Output is correct |
39 | Correct | 2771 ms | 133388 KB | Output is correct |
40 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 640 KB | Output is correct |
3 | Correct | 5 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 | 640 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 1128 ms | 27356 KB | Output is correct |
13 | Correct | 861 ms | 27568 KB | Output is correct |
14 | Correct | 1362 ms | 24692 KB | Output is correct |
15 | Correct | 1363 ms | 24392 KB | Output is correct |
16 | Correct | 842 ms | 15476 KB | Output is correct |
17 | Correct | 1342 ms | 24696 KB | Output is correct |
18 | Correct | 1341 ms | 24188 KB | Output is correct |
19 | Correct | 1731 ms | 12692 KB | Output is correct |
20 | Correct | 2795 ms | 6216 KB | Output is correct |
21 | Correct | 627 ms | 1212 KB | Output is correct |
22 | Correct | 2896 ms | 8960 KB | Output is correct |
23 | Correct | 668 ms | 14504 KB | Output is correct |
24 | Correct | 1654 ms | 10832 KB | Output is correct |
25 | Correct | 2912 ms | 14964 KB | Output is correct |
26 | Correct | 2478 ms | 15164 KB | Output is correct |
27 | Correct | 2341 ms | 14392 KB | Output is correct |
28 | Correct | 1172 ms | 157752 KB | Output is correct |
29 | Correct | 2876 ms | 175900 KB | Output is correct |
30 | Correct | 7455 ms | 120188 KB | Output is correct |
31 | Correct | 6978 ms | 91644 KB | Output is correct |
32 | Correct | 685 ms | 1148 KB | Output is correct |
33 | Correct | 929 ms | 2784 KB | Output is correct |
34 | Correct | 1601 ms | 172956 KB | Output is correct |
35 | Correct | 2085 ms | 88168 KB | Output is correct |
36 | Correct | 4311 ms | 173312 KB | Output is correct |
37 | Correct | 3281 ms | 173388 KB | Output is correct |
38 | Correct | 3142 ms | 172876 KB | Output is correct |
39 | Runtime error | 1144 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |