# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
121637 | 2019-06-26T21:23:11 Z | yusufake | 게임 (IOI13_game) | C++ | 7437 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 inline 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 | 3 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 | 3 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 | 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 | 1128 ms | 27784 KB | Output is correct |
5 | Correct | 848 ms | 27864 KB | Output is correct |
6 | Correct | 1247 ms | 25120 KB | Output is correct |
7 | Correct | 1278 ms | 24756 KB | Output is correct |
8 | Correct | 833 ms | 15960 KB | Output is correct |
9 | Correct | 1398 ms | 24804 KB | Output is correct |
10 | Correct | 1202 ms | 24132 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 | 3 ms | 640 KB | Output is correct |
10 | Correct | 2 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 1671 ms | 12884 KB | Output is correct |
13 | Correct | 2541 ms | 6196 KB | Output is correct |
14 | Correct | 636 ms | 1276 KB | Output is correct |
15 | Correct | 2851 ms | 9036 KB | Output is correct |
16 | Correct | 660 ms | 14876 KB | Output is correct |
17 | Correct | 1668 ms | 11096 KB | Output is correct |
18 | Correct | 2823 ms | 15004 KB | Output is correct |
19 | Correct | 2464 ms | 15312 KB | Output is correct |
20 | Correct | 2460 ms | 14520 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 | 640 KB | Output is correct |
3 | Correct | 4 ms | 640 KB | Output is correct |
4 | Correct | 1 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 | 380 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 | 512 KB | Output is correct |
12 | Correct | 1140 ms | 27524 KB | Output is correct |
13 | Correct | 869 ms | 27868 KB | Output is correct |
14 | Correct | 1293 ms | 24632 KB | Output is correct |
15 | Correct | 1329 ms | 24624 KB | Output is correct |
16 | Correct | 814 ms | 15736 KB | Output is correct |
17 | Correct | 1372 ms | 24696 KB | Output is correct |
18 | Correct | 1185 ms | 24324 KB | Output is correct |
19 | Correct | 1698 ms | 12624 KB | Output is correct |
20 | Correct | 2521 ms | 6220 KB | Output is correct |
21 | Correct | 635 ms | 1400 KB | Output is correct |
22 | Correct | 2863 ms | 9140 KB | Output is correct |
23 | Correct | 677 ms | 14724 KB | Output is correct |
24 | Correct | 1724 ms | 11080 KB | Output is correct |
25 | Correct | 2795 ms | 15128 KB | Output is correct |
26 | Correct | 2516 ms | 15216 KB | Output is correct |
27 | Correct | 2373 ms | 14720 KB | Output is correct |
28 | Correct | 1194 ms | 158092 KB | Output is correct |
29 | Correct | 3011 ms | 176232 KB | Output is correct |
30 | Correct | 7339 ms | 120332 KB | Output is correct |
31 | Correct | 6649 ms | 92188 KB | Output is correct |
32 | Correct | 693 ms | 1684 KB | Output is correct |
33 | Correct | 919 ms | 3208 KB | Output is correct |
34 | Correct | 1552 ms | 173244 KB | Output is correct |
35 | Correct | 2115 ms | 88308 KB | Output is correct |
36 | Correct | 4149 ms | 173784 KB | Output is correct |
37 | Correct | 3421 ms | 173860 KB | Output is correct |
38 | Correct | 3443 ms | 173128 KB | Output is correct |
39 | Correct | 2763 ms | 133508 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 | 3 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 | 12 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 | 1146 ms | 27436 KB | Output is correct |
13 | Correct | 848 ms | 27608 KB | Output is correct |
14 | Correct | 1242 ms | 24632 KB | Output is correct |
15 | Correct | 1345 ms | 24364 KB | Output is correct |
16 | Correct | 807 ms | 15544 KB | Output is correct |
17 | Correct | 1338 ms | 24552 KB | Output is correct |
18 | Correct | 1247 ms | 24128 KB | Output is correct |
19 | Correct | 1724 ms | 12644 KB | Output is correct |
20 | Correct | 2640 ms | 6120 KB | Output is correct |
21 | Correct | 625 ms | 1208 KB | Output is correct |
22 | Correct | 3060 ms | 8952 KB | Output is correct |
23 | Correct | 665 ms | 14592 KB | Output is correct |
24 | Correct | 1717 ms | 10852 KB | Output is correct |
25 | Correct | 2943 ms | 14940 KB | Output is correct |
26 | Correct | 2555 ms | 15112 KB | Output is correct |
27 | Correct | 2725 ms | 14504 KB | Output is correct |
28 | Correct | 1141 ms | 157796 KB | Output is correct |
29 | Correct | 2841 ms | 176040 KB | Output is correct |
30 | Correct | 7437 ms | 120148 KB | Output is correct |
31 | Correct | 6726 ms | 91844 KB | Output is correct |
32 | Correct | 688 ms | 1520 KB | Output is correct |
33 | Correct | 916 ms | 3056 KB | Output is correct |
34 | Correct | 1567 ms | 172960 KB | Output is correct |
35 | Correct | 2274 ms | 88364 KB | Output is correct |
36 | Correct | 4383 ms | 173596 KB | Output is correct |
37 | Correct | 3584 ms | 173540 KB | Output is correct |
38 | Correct | 3435 ms | 172980 KB | Output is correct |
39 | Runtime error | 1139 ms | 256000 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
40 | Halted | 0 ms | 0 KB | - |