Submission #140438

# Submission time Handle Problem Language Result Execution time Memory
140438 2019-08-03T00:37:29 Z cfalas Game (IOI13_game) C++14
0 / 100
2 ms 400 KB
#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

grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
game.cpp: In function 'int query(int, int, int, int, int)':
game.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 400 KB Output isn't correct
2 Halted 0 ms 0 KB -