#include "game.h"
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;
}
#include <bits/stdc++.h>
using namespace std;
long long v[22000][3];
int sz;
void init(int R, int C) {
}
void update(int P, int Q, long long K) {
for (int i=0; i<sz; ++i) if (v[i][0]==P && v[i][1]==Q){
v[i][2]=K;
return;
}
v[sz][0]=P; v[sz][1]=Q; v[sz][2]=K;
++sz;
}
long long calculate(int P, int Q, int U, int V) {
long long ans=0;
for (int i=0; i<sz; ++i) if (P<=v[i][0] && v[i][0]<=U && Q<=v[i][1] && v[i][1]<=V) ans=gcd2(ans, v[i][2]);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
396 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
5544 ms |
8880 KB |
Output is correct |
5 |
Correct |
4790 ms |
8792 KB |
Output is correct |
6 |
Correct |
5917 ms |
6296 KB |
Output is correct |
7 |
Correct |
11362 ms |
5864 KB |
Output is correct |
8 |
Correct |
2536 ms |
6224 KB |
Output is correct |
9 |
Correct |
9416 ms |
6016 KB |
Output is correct |
10 |
Correct |
10822 ms |
5808 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
6193 ms |
8752 KB |
Output is correct |
13 |
Correct |
8206 ms |
4996 KB |
Output is correct |
14 |
Correct |
472 ms |
5652 KB |
Output is correct |
15 |
Correct |
8313 ms |
5716 KB |
Output is correct |
16 |
Execution timed out |
13097 ms |
5328 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
5643 ms |
9032 KB |
Output is correct |
13 |
Correct |
4948 ms |
8836 KB |
Output is correct |
14 |
Correct |
5868 ms |
6224 KB |
Output is correct |
15 |
Correct |
11588 ms |
5912 KB |
Output is correct |
16 |
Correct |
2376 ms |
6228 KB |
Output is correct |
17 |
Correct |
9117 ms |
6104 KB |
Output is correct |
18 |
Correct |
10768 ms |
5728 KB |
Output is correct |
19 |
Correct |
6391 ms |
8704 KB |
Output is correct |
20 |
Correct |
8229 ms |
5204 KB |
Output is correct |
21 |
Correct |
490 ms |
5504 KB |
Output is correct |
22 |
Correct |
8429 ms |
5532 KB |
Output is correct |
23 |
Execution timed out |
13038 ms |
4944 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
432 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
5727 ms |
9084 KB |
Output is correct |
13 |
Correct |
5090 ms |
8784 KB |
Output is correct |
14 |
Correct |
6123 ms |
6228 KB |
Output is correct |
15 |
Correct |
11047 ms |
6080 KB |
Output is correct |
16 |
Correct |
2454 ms |
6336 KB |
Output is correct |
17 |
Correct |
9441 ms |
6032 KB |
Output is correct |
18 |
Correct |
11078 ms |
5684 KB |
Output is correct |
19 |
Correct |
6393 ms |
8748 KB |
Output is correct |
20 |
Correct |
8161 ms |
5244 KB |
Output is correct |
21 |
Correct |
488 ms |
5456 KB |
Output is correct |
22 |
Correct |
8422 ms |
5712 KB |
Output is correct |
23 |
Execution timed out |
13024 ms |
5036 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |