# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
235370 |
2020-05-28T07:21:25 Z |
crossing0ver |
Game (IOI13_game) |
C++17 |
|
13000 ms |
22600 KB |
#include<bits/stdc++.h>
#define ll long long
#include "game.h"
using namespace std;
long long gcd2(long long X, long long Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
ll t[100][4*100001] , R, C;
ll t1[2000][4*2001];
void upd (int s,int v,int tl,int tr,int pos,ll val) {
if (tl == tr) {
t[s][v] = val;
return;
}
int tm = (tl + tr)/2;
if (pos <= tm) upd(s,v*2,tl,tm,pos,val);
else upd(s,v*2|1,tm+1,tr,pos,val);
t[s][v] = gcd2(t[s][v*2],t[s][v*2|1]);
}
void upd1 (int s,int v,int tl,int tr,int pos,ll val) {
if (tl == tr) {
t1[s][v] = val;
return;
}
int tm = (tl + tr)/2;
if (pos <= tm) upd1(s,v*2,tl,tm,pos,val);
else upd1(s,v*2|1,tm+1,tr,pos,val);
t1[s][v] = gcd2(t1[s][v*2],t1[s][v*2|1]);
}
ll get (int s,int v,int tl,int tr,int l,int r) {
if (l > tr || r < tl) return 0;
if (l <= tl && r >= tr) {
return t[s][v];
}
int tm = (tl + tr)/2;
return gcd2 ( get (s,v*2,tl,tm,l,r), get (s,v*2|1,tm+1,tr,l,r));
}
ll get1 (int s,int v,int tl,int tr,int l,int r) {
if (l > tr || r < tl) return 0;
if (l <= tl && r >= tr) {
return t1[s][v];
}
int tm = (tl + tr)/2;
return gcd2 ( get1 (s,v*2,tl,tm,l,r), get1 (s,v*2|1,tm+1,tr,l,r));
}
void update(int P, int Q, long long K) {
if (C > 2000 || R > 2000)
upd (P,1,0,100000,Q,K);
else upd1 (P,1,0,2000,Q,K);
}
long long calculate(int P, int Q, int U, int V) {
/* ... */
ll s = 0;
for (int i = P; i <= U; i++) {
if (C > 2000 || R > 2000)
s = gcd2(s,get (i,1,0,100000,Q,V));
else s = s = gcd2(s,get1 (i,1,0,2000,Q,V));
}
return s;
}
void init(int R1, int C1) {R = R1; C = C1;}
Compilation message
grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int res;
^~~
game.cpp: In function 'long long int calculate(int, int, int, int)':
game.cpp:65:10: warning: operation on 's' may be undefined [-Wsequence-point]
else s = s = gcd2(s,get1 (i,1,0,2000,Q,V));
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
1408 KB |
Output is correct |
3 |
Correct |
6 ms |
1408 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
1408 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
1280 KB |
Output is correct |
10 |
Correct |
5 ms |
768 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
1020 ms |
20760 KB |
Output is correct |
5 |
Correct |
670 ms |
21024 KB |
Output is correct |
6 |
Correct |
845 ms |
21496 KB |
Output is correct |
7 |
Correct |
881 ms |
21240 KB |
Output is correct |
8 |
Correct |
676 ms |
19832 KB |
Output is correct |
9 |
Correct |
876 ms |
21368 KB |
Output is correct |
10 |
Correct |
763 ms |
20728 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
1408 KB |
Output is correct |
3 |
Correct |
6 ms |
1408 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
1408 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
6 ms |
1280 KB |
Output is correct |
10 |
Correct |
5 ms |
768 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Execution timed out |
13052 ms |
22440 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
1408 KB |
Output is correct |
3 |
Correct |
6 ms |
1408 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
1408 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
1280 KB |
Output is correct |
10 |
Correct |
5 ms |
768 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
978 ms |
20856 KB |
Output is correct |
13 |
Correct |
661 ms |
20984 KB |
Output is correct |
14 |
Correct |
811 ms |
21456 KB |
Output is correct |
15 |
Correct |
816 ms |
21112 KB |
Output is correct |
16 |
Correct |
724 ms |
19832 KB |
Output is correct |
17 |
Correct |
828 ms |
21160 KB |
Output is correct |
18 |
Correct |
746 ms |
20728 KB |
Output is correct |
19 |
Execution timed out |
13031 ms |
22600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
1408 KB |
Output is correct |
3 |
Correct |
6 ms |
1408 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
1408 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
1280 KB |
Output is correct |
10 |
Correct |
5 ms |
768 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
1020 ms |
20728 KB |
Output is correct |
13 |
Correct |
644 ms |
21068 KB |
Output is correct |
14 |
Correct |
806 ms |
21524 KB |
Output is correct |
15 |
Correct |
833 ms |
21220 KB |
Output is correct |
16 |
Correct |
699 ms |
19832 KB |
Output is correct |
17 |
Correct |
844 ms |
21364 KB |
Output is correct |
18 |
Correct |
782 ms |
20852 KB |
Output is correct |
19 |
Execution timed out |
13067 ms |
22224 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |