이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |