제출 #321004

#제출 시각아이디문제언어결과실행 시간메모리
321004neki게임 (IOI14_game)C++14
100 / 100
505 ms25516 KiB
#include "game.h" #include <bits/stdc++.h> #define loop(i, a, b) for(long long i=a;i<b;i++) #define pool(i, a, b) for(long long i=a-1;i>=b;i--) #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define pa pair<ll, ll> #define ll int #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 1510 #define pa pair<ll, ll> #define ld long double ll dsu[mn], cnt[mn][mn], n; vc<ll> nos[mn]; void initialize(int N){ n=N; loop(i, 0, n) dsu[i]=i, nos[i].ps(i); } int hasEdge(int u, int v){ ll a=dsu[u], b=dsu[v]; if(nos[a].size()<nos[b].size()) swap(a, b); if(a!=b){ if(cnt[a][b]==(ll)(nos[a].size() * nos[b].size()) -1){ fore(v, nos[b]) dsu[v]=a; fore(v, nos[b]) nos[a].ps(v); loop(i, 0, n) cnt[a][i]+=cnt[b][i]; loop(i, 0, n) cnt[i][a]+=cnt[i][b]; return 1; } else{ cnt[a][b]++, cnt[b][a]++; return 0; } } else return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...