제출 #716333

#제출 시각아이디문제언어결과실행 시간메모리
716333ovidiush11게임 (IOI14_game)C++14
42 / 100
90 ms4340 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...