# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
235376 |
2020-05-28T07:29:27 Z |
crossing0ver |
Game (IOI13_game) |
C++17 |
|
13000 ms |
22784 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];
ll t1[2000][4*2001];
int pos,l,r,sd,R,C;
ll val;
void upd (int v,int tl,int tr) {
if (tl == tr) {
t[sd][v] = val;
return;
}
int tm = (tl + tr)/2;
if (pos <= tm) upd(v*2,tl,tm);
else upd(v*2|1,tm+1,tr);
t[sd][v] = gcd2(t[sd][v*2],t[sd][v*2|1]);
}
void upd1 (int v,int tl,int tr) {
if (tl == tr) {
t1[sd][v] = val;
return;
}
int tm = (tl + tr)/2;
if (pos <= tm) upd1(v*2,tl,tm);
else upd1(v*2|1,tm+1,tr);
t1[sd][v] = gcd2(t1[sd][v*2],t1[sd][v*2|1]);
}
ll get (int v,int tl,int tr) {
if (l > tr || r < tl) return 0;
if (l <= tl && r >= tr) {
return t[sd][v];
}
int tm = (tl + tr)/2;
return gcd2 ( get (v*2,tl,tm), get (v*2|1,tm+1,tr));
}
ll get1 (int v,int tl,int tr) {
if (l > tr || r < tl) return 0;
if (l <= tl && r >= tr) {
return t1[sd][v];
}
int tm = (tl + tr)/2;
return gcd2 ( get1 (v*2,tl,tm), get1 (v*2|1,tm+1,tr));
}
void update(int P, int Q, long long K) {
sd = P;
val = K; pos = Q;
if (C > 2000 || R > 2000)
upd (1,0,100000);
else upd1 (1,0,2000);
}
ll s;
long long calculate(int P, int Q, int U, int V) {
s = 0;
l = Q; r = V;
if (C > 2000 || R > 2000)
for (sd = P; sd <= U; sd++)
s = gcd2(s,get (1,0,100000));
else
for (sd = P; sd <= U; sd++)
s = gcd2(s,get1 (1,0,2000));
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:69:5: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
else
^~~~
game.cpp:72:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
return s;
^~~~~~
# |
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 |
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 |
256 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 |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
1035 ms |
21624 KB |
Output is correct |
5 |
Correct |
656 ms |
21752 KB |
Output is correct |
6 |
Correct |
791 ms |
22024 KB |
Output is correct |
7 |
Correct |
824 ms |
21720 KB |
Output is correct |
8 |
Correct |
676 ms |
20500 KB |
Output is correct |
9 |
Correct |
815 ms |
22008 KB |
Output is correct |
10 |
Correct |
759 ms |
21368 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 |
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 |
6 ms |
768 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Execution timed out |
13041 ms |
22784 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 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 |
995 ms |
21628 KB |
Output is correct |
13 |
Correct |
657 ms |
21624 KB |
Output is correct |
14 |
Correct |
802 ms |
22136 KB |
Output is correct |
15 |
Correct |
866 ms |
21868 KB |
Output is correct |
16 |
Correct |
678 ms |
20472 KB |
Output is correct |
17 |
Correct |
819 ms |
21880 KB |
Output is correct |
18 |
Correct |
802 ms |
21292 KB |
Output is correct |
19 |
Execution timed out |
13087 ms |
22500 KB |
Time limit exceeded |
20 |
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 |
7 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 |
974 ms |
21624 KB |
Output is correct |
13 |
Correct |
648 ms |
21752 KB |
Output is correct |
14 |
Correct |
810 ms |
22076 KB |
Output is correct |
15 |
Correct |
808 ms |
21752 KB |
Output is correct |
16 |
Correct |
686 ms |
20352 KB |
Output is correct |
17 |
Correct |
804 ms |
21752 KB |
Output is correct |
18 |
Correct |
742 ms |
21432 KB |
Output is correct |
19 |
Execution timed out |
13101 ms |
22536 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |