# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
62839 | | mhnd | 게임 (IOI13_game) | C++14 | | 13096 ms | 116700 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;
ll seg[2010][4*2010],seg2[11][4*N];
int c,type;
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 l,r,val,cur;
void update1(int n,int s,int e){
if(s > r || e < l)return;
if(s == e){
if(type)seg[cur][n] = val;
else seg2[cur][n] = val;
return;
}
update1(n*2,s,(s+e)/2);
update1(n*2+1,(s+e)/2+1,e);
if(type)seg[cur][n] = gcd2(seg[cur][n*2],seg[cur][n*2+1]);
else seg2[cur][n] = gcd2(seg2[cur][n*2],seg2[cur][n*2+1]);
}
ll get(int n,int s,int e){
if(s > r || e < l)return 0;
if(s >= l && e <= r){
if(type)return seg[cur][n];
else return seg2[cur][n];
}
return gcd2(get(n*2,s,(s+e)/2),get(n*2+1,(s+e)/2+1,e));
}
void init(int R, int C) {
type = (R>10);
c=C;
}
void update(int P, int Q, long long K) {
Q++;
l = r = Q;
val = K;
cur = P;
update1(1,1,c);
}
long long calculate(int P, int Q, int U, int V) {
l = Q+1;
r = V+1;
ll ans = 0;
for(int i=P;i<=U;i++){
cur = i;
ans = gcd2(ans,get(1,1,c));
}
return ans;
}
Compilation message (stderr)
grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int 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... |