Submission #349755

# Submission time Handle Problem Language Result Execution time Memory
349755 2021-01-18T10:14:15 Z juggernaut Game (IOI13_game) C++14
63 / 100
897 ms 256004 KB
#include"game.h"
#include<bits/stdc++.h>
#ifndef EVAL
#include"grader.c"
#endif
using namespace std;
typedef long long ll;
ll n,m;
vector<vector<ll>>t;
void init(int R,int C){
	n=R,m=C;
	t.assign(n*2,vector<ll>(m*2,0));
}
void update(int x,int y,ll val){
	for(x+=n;x>=1;x>>=1){
		int i=y+m;
		for(;i>0;i>>=1){
			if(x>=n&&i>=m)t[x][i]=val;
			else if(i>=m)t[x][i]=__gcd(t[x<<1][i],t[x<<1|1][i]);
			t[x][i>>1]=__gcd(t[x][i],t[x][i^1]);
		}
	}
}
ll calculate(int x1,int y1,int x2,int y2){
    ll res=0;
	for(x1+=n,x2+=n;x1<=x2;x1>>=1,x2>>=1){
		if(x1&1){
			for(int l=y1+m,r=y2+m;l<=r;l>>=1,r>>=1){
				if(l&1)res=__gcd(res,t[x1][l++]);
				if(!(r&1))res=__gcd(res,t[x1][r--]);
			}
			x1++;
		}if(!(x2&1)){
			for(int l=y1+m,r=y2+m;l<=r;l>>=1,r>>=1){
				if(l&1)res=__gcd(res,t[x2][l++]);
				if(!(r&1))res=__gcd(res,t[x2][r--]);
			}
			x2--;
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 620 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 420 ms 38992 KB Output is correct
5 Correct 307 ms 39396 KB Output is correct
6 Correct 402 ms 36208 KB Output is correct
7 Correct 406 ms 35868 KB Output is correct
8 Correct 364 ms 36560 KB Output is correct
9 Correct 398 ms 35920 KB Output is correct
10 Correct 360 ms 35536 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 620 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 586 ms 39148 KB Output is correct
13 Correct 626 ms 35840 KB Output is correct
14 Correct 441 ms 129772 KB Output is correct
15 Correct 802 ms 129964 KB Output is correct
16 Correct 323 ms 129900 KB Output is correct
17 Correct 744 ms 130412 KB Output is correct
18 Correct 891 ms 130156 KB Output is correct
19 Correct 870 ms 130284 KB Output is correct
20 Correct 822 ms 129644 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 640 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 417 ms 38924 KB Output is correct
13 Correct 307 ms 39376 KB Output is correct
14 Correct 405 ms 36048 KB Output is correct
15 Correct 402 ms 35792 KB Output is correct
16 Correct 334 ms 36560 KB Output is correct
17 Correct 397 ms 35792 KB Output is correct
18 Correct 359 ms 35424 KB Output is correct
19 Correct 580 ms 39148 KB Output is correct
20 Correct 623 ms 35820 KB Output is correct
21 Correct 430 ms 129628 KB Output is correct
22 Correct 816 ms 129744 KB Output is correct
23 Correct 334 ms 129644 KB Output is correct
24 Correct 775 ms 130820 KB Output is correct
25 Correct 896 ms 130484 KB Output is correct
26 Correct 884 ms 129960 KB Output is correct
27 Correct 823 ms 129456 KB Output is correct
28 Runtime error 142 ms 256004 KB Execution killed with signal 9 (could be triggered by violating memory limits)
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 620 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 414 ms 39632 KB Output is correct
13 Correct 306 ms 39760 KB Output is correct
14 Correct 416 ms 36360 KB Output is correct
15 Correct 405 ms 36176 KB Output is correct
16 Correct 341 ms 36944 KB Output is correct
17 Correct 396 ms 36304 KB Output is correct
18 Correct 356 ms 35920 KB Output is correct
19 Correct 591 ms 39044 KB Output is correct
20 Correct 635 ms 35484 KB Output is correct
21 Correct 431 ms 129388 KB Output is correct
22 Correct 802 ms 129512 KB Output is correct
23 Correct 341 ms 129604 KB Output is correct
24 Correct 756 ms 130440 KB Output is correct
25 Correct 897 ms 129900 KB Output is correct
26 Correct 882 ms 130028 KB Output is correct
27 Correct 796 ms 129516 KB Output is correct
28 Runtime error 139 ms 256000 KB Execution killed with signal 9 (could be triggered by violating memory limits)
29 Halted 0 ms 0 KB -