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,i = 0,n = num;
while(p/2 < n)
{
a[i].resize(n/(p*2)+1);
for(auto &x : a[i])x = p * min(p,n-p);
i++;
p *= 2;
}
groups = i;
return ;
}
int hasEdge(int u, int v)
{
if(u > v)swap(u,v);
if(u + 1 == v && u % 2 == 0)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... |