제출 #16909

#제출 시각아이디문제언어결과실행 시간메모리
16909erdemkiraz게임 (IOI14_game)C++98
100 / 100
481 ms23544 KiB
#include "game.h" #include <algorithm> #include <iostream> #include <cassert> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> #include <queue> #include <map> #include <set> using namespace std; #define type(x) __typeof((x).begin()) #define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); it++) typedef long long ll; typedef pair < int, int > ii; const int inf = 1e9 + 333; const ll linf = 1e18 + 333; const int N = 1500 + 5; int n, cnt, in[N], query_in[N]; vector < int > v[N]; void initialize(int n) { :: n = n; } int hasEdge(int x, int y) { if(!cnt) { cnt = 2; in[x] = in[y] = 1; query_in[x] = query_in[y] = 1; return 1; } if(!in[x] and !in[y]) { v[x].push_back(y); v[y].push_back(x); return 0; } assert(!in[x] or !in[y]); if(!in[x]) swap(x, y); if(query_in[y] == cnt - 1) { in[y] = 1; cnt++; foreach(it, v[y]) query_in[*it]++; return 1; } query_in[y]++; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...