Submission #134413

# Submission time Handle Problem Language Result Execution time Memory
134413 2019-07-22T16:23:15 Z arthurconmy Game (IOI13_game) C++14
27 / 100
945 ms 83704 KB
#include <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
	#include "game.h"
#endif
using namespace std;
using ll=long long;

const int p2=262144;
ll st[10][p2+p2];

ll grid[100][100];
int r,c;

void init(int r_r, int c_r)
{
	r=r_r;
	c=c_r;

	for(int i=0; i<100; i++)
	{
		for(int j=0; j<100; j++)
		{
			grid[i][j]=0;
		}
	}

	for(int i=0; i<10; i++)
	{
		for(int j=0; j<p2+p2; j++)
		{
			st[i][j]=0;
		}
	}
}

void update(int p, int q, ll k)
{
	q += p2;
	st[p][q]=k;

	q/=2;

	while(q>0)
	{
		st[p][q] = __gcd(st[p][q+q],st[p][q+q+1]);
		q/=2;
	}
}

ll query(int p, int l, int r)
{
	l+=p2;
	r+=p2;

	ll ans=0;

	while(l<=r)
	{
		if(l%2 == 1) ans=__gcd(ans,st[p][l++]);
		if(r%2 == 0) ans=__gcd(ans,st[p][r--]);
		l/=2;
		r/=2;
	}

	return ans;
}

ll calculate(int p, int q, int u, int v)
{
	ll cur_gcd = 0;

	for(int i=p; i<=u; i++)
	{
		cur_gcd = __gcd(cur_gcd,query(i,q,v));
	}

	#ifdef ARTHUR_LOCAL
		cout << cur_gcd << endl;
	#endif

	return cur_gcd;
}

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 35 ms 41464 KB Output is correct
2 Runtime error 95 ms 83704 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 41476 KB Output is correct
2 Correct 35 ms 41464 KB Output is correct
3 Correct 38 ms 41468 KB Output is correct
4 Correct 945 ms 49816 KB Output is correct
5 Correct 608 ms 49660 KB Output is correct
6 Correct 839 ms 47184 KB Output is correct
7 Correct 912 ms 47012 KB Output is correct
8 Correct 677 ms 47244 KB Output is correct
9 Correct 878 ms 46972 KB Output is correct
10 Correct 731 ms 46624 KB Output is correct
11 Correct 35 ms 41460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 41464 KB Output is correct
2 Runtime error 89 ms 83584 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 41464 KB Output is correct
2 Runtime error 89 ms 83652 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 41464 KB Output is correct
2 Runtime error 91 ms 83600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -