#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;
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]);
}
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));
}
void update(int P, int Q, long long K) {
upd (P,1,0,100000,Q,K);
}
long long calculate(int P, int Q, int U, int V) {
/* ... */
ll s = 0;
for (int i = P; i <= U; i++) {
s = gcd2(s,get (i,1,0,100000,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;
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
3456 KB |
Output is correct |
3 |
Correct |
7 ms |
3456 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
896 KB |
Output is correct |
6 |
Correct |
6 ms |
3200 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
896 KB |
Output is correct |
9 |
Correct |
6 ms |
3200 KB |
Output is correct |
10 |
Correct |
6 ms |
1920 KB |
Output is correct |
11 |
Correct |
6 ms |
896 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
980 ms |
20668 KB |
Output is correct |
5 |
Correct |
659 ms |
24976 KB |
Output is correct |
6 |
Correct |
842 ms |
25980 KB |
Output is correct |
7 |
Correct |
889 ms |
25976 KB |
Output is correct |
8 |
Correct |
706 ms |
23960 KB |
Output is correct |
9 |
Correct |
891 ms |
25916 KB |
Output is correct |
10 |
Correct |
763 ms |
25336 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
3456 KB |
Output is correct |
3 |
Correct |
7 ms |
3456 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
896 KB |
Output is correct |
6 |
Correct |
6 ms |
3176 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
896 KB |
Output is correct |
9 |
Correct |
7 ms |
3200 KB |
Output is correct |
10 |
Correct |
6 ms |
1920 KB |
Output is correct |
11 |
Correct |
6 ms |
896 KB |
Output is correct |
12 |
Runtime error |
18 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
3456 KB |
Output is correct |
3 |
Correct |
7 ms |
3456 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
896 KB |
Output is correct |
6 |
Correct |
6 ms |
3200 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
896 KB |
Output is correct |
9 |
Correct |
6 ms |
3200 KB |
Output is correct |
10 |
Correct |
6 ms |
2048 KB |
Output is correct |
11 |
Correct |
6 ms |
896 KB |
Output is correct |
12 |
Correct |
1012 ms |
20728 KB |
Output is correct |
13 |
Correct |
651 ms |
24952 KB |
Output is correct |
14 |
Correct |
816 ms |
25980 KB |
Output is correct |
15 |
Correct |
861 ms |
25740 KB |
Output is correct |
16 |
Correct |
692 ms |
24004 KB |
Output is correct |
17 |
Correct |
832 ms |
25720 KB |
Output is correct |
18 |
Correct |
747 ms |
25336 KB |
Output is correct |
19 |
Runtime error |
18 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
3456 KB |
Output is correct |
3 |
Correct |
7 ms |
3328 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
896 KB |
Output is correct |
6 |
Correct |
6 ms |
3200 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
896 KB |
Output is correct |
9 |
Correct |
6 ms |
3200 KB |
Output is correct |
10 |
Correct |
6 ms |
1920 KB |
Output is correct |
11 |
Correct |
5 ms |
896 KB |
Output is correct |
12 |
Correct |
1008 ms |
20696 KB |
Output is correct |
13 |
Correct |
667 ms |
24952 KB |
Output is correct |
14 |
Correct |
829 ms |
25976 KB |
Output is correct |
15 |
Correct |
832 ms |
25848 KB |
Output is correct |
16 |
Correct |
695 ms |
23928 KB |
Output is correct |
17 |
Correct |
836 ms |
25848 KB |
Output is correct |
18 |
Correct |
771 ms |
25464 KB |
Output is correct |
19 |
Runtime error |
18 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Halted |
0 ms |
0 KB |
- |