# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
121614 | 2019-06-26T20:42:20 Z | yusufake | 게임 (IOI13_game) | C++ | 7326 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(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
# | 결과 | 실행 시간 | 메모리 | 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 | 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 | 2 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 | 1098 ms | 27416 KB | Output is correct |
5 | Correct | 847 ms | 27628 KB | Output is correct |
6 | Correct | 1329 ms | 24604 KB | Output is correct |
7 | Correct | 1320 ms | 24428 KB | Output is correct |
8 | Correct | 820 ms | 15548 KB | Output is correct |
9 | Correct | 1319 ms | 24432 KB | Output is correct |
10 | Correct | 1192 ms | 24204 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 | 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 | 4 ms | 640 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 | 12700 KB | Output is correct |
13 | Correct | 2485 ms | 6212 KB | Output is correct |
14 | Correct | 610 ms | 1292 KB | Output is correct |
15 | Correct | 2843 ms | 9032 KB | Output is correct |
16 | Correct | 658 ms | 14840 KB | Output is correct |
17 | Correct | 1693 ms | 10864 KB | Output is correct |
18 | Correct | 2816 ms | 15048 KB | Output is correct |
19 | Correct | 2472 ms | 15152 KB | Output is correct |
20 | Correct | 2275 ms | 14440 KB | Output is correct |
21 | Correct | 2 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 | 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 | 612 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 1139 ms | 27356 KB | Output is correct |
13 | Correct | 840 ms | 27636 KB | Output is correct |
14 | Correct | 1281 ms | 24748 KB | Output is correct |
15 | Correct | 1280 ms | 24312 KB | Output is correct |
16 | Correct | 807 ms | 15536 KB | Output is correct |
17 | Correct | 1339 ms | 24528 KB | Output is correct |
18 | Correct | 1245 ms | 24056 KB | Output is correct |
19 | Correct | 1673 ms | 12764 KB | Output is correct |
20 | Correct | 2508 ms | 6020 KB | Output is correct |
21 | Correct | 610 ms | 1272 KB | Output is correct |
22 | Correct | 2893 ms | 9040 KB | Output is correct |
23 | Correct | 716 ms | 14480 KB | Output is correct |
24 | Correct | 1783 ms | 10876 KB | Output is correct |
25 | Correct | 2942 ms | 14864 KB | Output is correct |
26 | Correct | 2602 ms | 14964 KB | Output is correct |
27 | Correct | 2461 ms | 14464 KB | Output is correct |
28 | Correct | 1174 ms | 157616 KB | Output is correct |
29 | Correct | 2946 ms | 175792 KB | Output is correct |
30 | Correct | 7326 ms | 120032 KB | Output is correct |
31 | Correct | 6879 ms | 91720 KB | Output is correct |
32 | Correct | 714 ms | 1360 KB | Output is correct |
33 | Correct | 932 ms | 2844 KB | Output is correct |
34 | Correct | 1555 ms | 172992 KB | Output is correct |
35 | Correct | 2180 ms | 88116 KB | Output is correct |
36 | Correct | 4383 ms | 173364 KB | Output is correct |
37 | Correct | 3400 ms | 173568 KB | Output is correct |
38 | Correct | 3475 ms | 172700 KB | Output is correct |
39 | Correct | 3147 ms | 133424 KB | Output is correct |
40 | Correct | 4 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 | 4 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 6 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 | 512 KB | Output is correct |
12 | Correct | 1098 ms | 27448 KB | Output is correct |
13 | Correct | 850 ms | 27664 KB | Output is correct |
14 | Correct | 1294 ms | 24648 KB | Output is correct |
15 | Correct | 1308 ms | 24344 KB | Output is correct |
16 | Correct | 811 ms | 15532 KB | Output is correct |
17 | Correct | 1249 ms | 24572 KB | Output is correct |
18 | Correct | 1163 ms | 24032 KB | Output is correct |
19 | Correct | 1702 ms | 12764 KB | Output is correct |
20 | Correct | 2499 ms | 6012 KB | Output is correct |
21 | Correct | 619 ms | 1244 KB | Output is correct |
22 | Correct | 2818 ms | 8920 KB | Output is correct |
23 | Correct | 666 ms | 14712 KB | Output is correct |
24 | Correct | 1760 ms | 11048 KB | Output is correct |
25 | Correct | 2866 ms | 14992 KB | Output is correct |
26 | Correct | 2533 ms | 15028 KB | Output is correct |
27 | Correct | 2368 ms | 14488 KB | Output is correct |
28 | Correct | 1154 ms | 157656 KB | Output is correct |
29 | Correct | 2807 ms | 175940 KB | Output is correct |
30 | Correct | 7298 ms | 120060 KB | Output is correct |
31 | Correct | 6671 ms | 91724 KB | Output is correct |
32 | Correct | 681 ms | 1104 KB | Output is correct |
33 | Correct | 915 ms | 2868 KB | Output is correct |
34 | Correct | 1579 ms | 173168 KB | Output is correct |
35 | Correct | 2298 ms | 88200 KB | Output is correct |
36 | Correct | 4645 ms | 173448 KB | Output is correct |
37 | Correct | 3424 ms | 173444 KB | Output is correct |
38 | Correct | 3430 ms | 172892 KB | Output is correct |
39 | Runtime error | 1217 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |