#include "game.h"
//#include "grader.cpp"
#include <bits/stdc++.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;
}
vector < vector <int> > ar;
vector < pair <int, int> > vec;
void init(int R, int C) {
ar.resize(R);
for(int i = 0; i < R; i ++)
ar[i].resize(C + 1);
}
void update(int P, int Q, long long K) {
ar[P][Q] = K;
vec.emplace_back(P, Q);
}
long long calculate(int P, int Q, int U, int V) {
long long ans = 0;
int sz = (int)vec.size();
for(int i = 0; i < sz; i ++){
if(vec[i].first >= P && vec[i].first <= U && vec[i].second >= Q && vec[i].second <= V)
ans = gcd2(ans, ar[vec[i].first][vec[i].second]);
}
return ans;
}
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 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |