#include <bits/stdc++.h>
#include "game.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define X first
#define Y second
#define SZ(x) ll(x.size())
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;
}
vector<pair<ll , pii>> vec;
void init(int R, int C) {
//
}
void update(int P, int Q, long long K) {
for(int i = 0 ; i < SZ(vec) ; i++){
if(vec[i].Y.X == P && vec[i].Y.Y == Q){
vec[i].X = K;
return;
}
}
int ptr = SZ(vec);
vec.push_back({K , {P , Q}});
while(ptr > 0 && vec[ptr].Y < vec[ptr - 1].Y) swap(vec[ptr] , vec[ptr - 1]) , ptr--;
}
long long calculate(int P, int Q, int U, int V) {
ll res = 0;
for(pair<ll , pii> i : vec){
if(P <= i.Y.X && i.Y.X <= U && Q <= i.Y.Y && i.Y.Y <= V) res = gcd2(res , i.X);
}
return res;
}
# |
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 |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 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 |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 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 |
384 KB |
Output is correct |
4 |
Correct |
11409 ms |
4476 KB |
Output is correct |
5 |
Correct |
6962 ms |
5068 KB |
Output is correct |
6 |
Correct |
4107 ms |
1896 KB |
Output is correct |
7 |
Correct |
7909 ms |
1572 KB |
Output is correct |
8 |
Correct |
1248 ms |
2284 KB |
Output is correct |
9 |
Correct |
5753 ms |
1512 KB |
Output is correct |
10 |
Correct |
7721 ms |
1128 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 |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 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 |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Execution timed out |
13095 ms |
5216 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
2 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 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 |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
11356 ms |
5100 KB |
Output is correct |
13 |
Correct |
6941 ms |
8984 KB |
Output is correct |
14 |
Correct |
4080 ms |
6376 KB |
Output is correct |
15 |
Correct |
7846 ms |
6376 KB |
Output is correct |
16 |
Correct |
1259 ms |
6564 KB |
Output is correct |
17 |
Correct |
5797 ms |
6672 KB |
Output is correct |
18 |
Correct |
7768 ms |
6212 KB |
Output is correct |
19 |
Execution timed out |
13002 ms |
9040 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 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 |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
11359 ms |
5184 KB |
Output is correct |
13 |
Correct |
6900 ms |
9060 KB |
Output is correct |
14 |
Correct |
4149 ms |
6432 KB |
Output is correct |
15 |
Correct |
7837 ms |
6012 KB |
Output is correct |
16 |
Correct |
1273 ms |
6728 KB |
Output is correct |
17 |
Correct |
5802 ms |
6376 KB |
Output is correct |
18 |
Correct |
7788 ms |
6012 KB |
Output is correct |
19 |
Execution timed out |
13031 ms |
8948 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |