제출 #1016634

#제출 시각아이디문제언어결과실행 시간메모리
1016634Ice_man게임 (IOI14_game)C++14
100 / 100
226 ms17004 KiB
/** ____ ____ ____ __________________ ____ ____ ____ ||I || ||c || ||e || || || ||M || ||a || ||n || ||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__|| |/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\| */ #include <iostream> #include <chrono> #include <vector> #include <algorithm> #include "game.h" #define maxn 1505 #define maxlog 20 #define INF 1000000010 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cout<<"passed"<<endl; using namespace std; typedef pair <int, int> pii; typedef long long ll; typedef pair <ll, ll> pll; typedef pair <int, ll> pil; typedef pair <ll, int> pli; typedef long double ld; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } int sz[maxn]; int br[maxn][maxn]; int par[maxn]; int n; int find_parent(int node) { return node == par[node]? node : par[node] = find_parent(par[node]); } void unite(int a , int b) { if(sz[a] < sz[b]) swap(a , b); par[b] = a; for(int i = 1; i <= n; i++) { if(i == a || i == b) continue; br[a][i] += br[b][i]; br[i][a] += br[i][b]; br[b][i] = 0; br[i][b] = 0; } } void initialize(int N) { n = N; for(int i = 1; i <= n; i++) par[i] = i; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) if(i != j) br[i][j] = 1; } int hasEdge(int u , int v) { u++; v++; u = find_parent(u); v = find_parent(v); br[u][v]--; br[v][u]--; if(br[u][v] == 0) { unite(u , v); return 1; } return 0; } /**int main() { #ifdef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); ///startT = std::chrono::high_resolution_clock::now(); add(1 , 1 , 10 , 2 , 9 , 4); _remove(1 , 1 , 10 , 5 , 10 , 1); _remove(1 , 1 , 10 , 4 , 7 , 5); add(1 , 1 , 10 , 1 , 6 , 3); add(1 , 1 , 10 , 3 , 3 , 5); _remove(1 , 1 , 10 , 7 , 8 , 0); answer(1 , 1 , 10); for(int i = 0; i < 10; i++) cout << ans[i] << " "; cout << endl; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...