Submission #115196

#TimeUsernameProblemLanguageResultExecution timeMemory
115196ly20Game (IOI14_game)C++14
100 / 100
511 ms34184 KiB
#include<bits/stdc++.h> using namespace std; #include "game.h" const int MAXN=1510,MAXL=13; pair<int,int> v[MAXN][MAXN]; int v1[MAXN][MAXL]; void initialize(int n) { for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { int k=0,k1=0; //int x=i^j; //k=__builtin_ctz(x); for(int l=0;l<MAXL;l++) { if(((1<<l)&i)!=((1<<l)&j)) { k1=l; break; } k+=((1<<l)&i); } v1[k][k1]++; v[i][j]=make_pair(k,k1);v[j][i]=make_pair(k,k1); } } } int hasEdge(int a,int b) { if(v1[v[a][b].first][v[a][b].second]<=1) { return 1; } else { v1[v[a][b].first][v[a][b].second]--; return 0; } } /*int main() { int n; scanf("%d",&n); initialize(n); for(int i=0;i<n;i++)printf("%d ",v1[i]); printf("\n"); int k=n*(n-1); k/=2; for(int i=0;i<k;i++) { int a,b; scanf("%d %d",&a,&b); printf("%d\n",hasEdge(a,b)); } }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...