# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140438 | cfalas | Game (IOI13_game) | C++14 | 2 ms | 400 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<bits/stdc++.h>
using namespace std;
#include "game.h"
long long gcd(long long X, long long Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
int rows, c;
int seg[10000];
int a[11][10000];
void init(int R, int C) {
rows = R, c = C;
}
void updateseg(int pos, int val, int l=0, int r=c-1, int ind=1){
if(l==r && l==pos){
seg[ind] = val;
return;
}
if(pos<l || pos>r) return;
int m = (l+r)/2;
updateseg(pos, val, l, m, ind*2);
updateseg(pos, val, m+1, r, ind*2+1);
seg[ind] = gcd(seg[ind*2], seg[ind*2+1]);
}
int query(int rl, int rr, int l=0, int r=c-1, int ind=1){
}
void update(int P, int Q, long long K) {
a[P][Q] = K;
/*int anspos = 0;
for(int i=0;i<rrows;i++){
anspos = gcd(anspos, a[i][Q]);
}
updateseg(Q, anspos);*/
}
long long calculate(int P, int Q, int U, int V) {
//cout<<"-----------------------\n";
//cout<<P<<" "<<Q<<" "<<U<<" "<<V<<endl;
long long ans=0;
for(int i=P;i<=U;i++){
for(int j=Q;j<=V;j++){
//cout<<a[i][j]<<" ";
ans = gcd(ans, a[i][j]);
}
//cout<<endl;
}
return ans;
}
Compilation message (stderr)
# | 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... |