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>
#include "game.h"
using namespace std;
const int N = 1500 + 5;
int n,groups;
vector<int> a[15];
void initialize(int num)
{
int p = 2,k = 0,n = num;
while(p < n)
{
int sz = n / (p*2);
if(n % (p*2) != 0)sz++;
a[k].resize(sz);
for(int i = 0;i < sz;i++)
{
if(n > i * p * 2 + p)a[k][i] = p * min(p,n - i*p*2-p);
else a[k][i] = 0;
}
k++;
p *= 2;
}
groups = k;
return ;
}
int hasEdge(int u, int v)
{
if(u > v)swap(u,v);
if(u/2 == v/2)return 1;
int k = 4;
for(int i = 0;i < groups;i++)
{
int x,y;
x = u / k;y = v / k;
if(x == y)
{
a[i][x]--;
if(a[i][x] == 0)return 1;
else return 0;
}
k *= 2;
}
return -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |