Submission #140440

# Submission time Handle Problem Language Result Execution time Memory
140440 2019-08-03T00:42:39 Z cfalas Game (IOI13_game) C++14
10 / 100
13000 ms 2872 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;
}

long long a[1000][1000];
int seg[10000];

void init(int R, int C) {
}

void updateseg(int pos, int val, int l=0, int r=/*TOTOOODSOSODOASD-*/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]);
}

void update(int P, int Q, long long K) {
	a[P][Q] = K;
}

long long calculate(int P, int Q, int U, int V) {
	long long ans=0;
	for(int i=P;i<=U;i++)
		for(int j=Q;j<=V;j++)
			ans = gcd(ans, a[i][j]);
	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;
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 636 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 404 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 368 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Execution timed out 13083 ms 1772 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Execution timed out 13020 ms 2872 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 636 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Execution timed out 13032 ms 2056 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 3 ms 680 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Execution timed out 13004 ms 1520 KB Time limit exceeded
13 Halted 0 ms 0 KB -