제출 #553095

#제출 시각아이디문제언어결과실행 시간메모리
553095fcmalkcin게임 (IOI14_game)C++17
100 / 100
421 ms25760 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; #define ll int #define pll pair<ll,ll> #define ff first #define ss second //#define endl "\n" #define pb push_back #define F(i,a,b) for(ll i=a;i<=b;i++) const ll maxn=1e3+5e2+100; const ll base=2e9; const ll mod= 1e9+7 ; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); ll par[maxn]; ll val[maxn][maxn]; ll find_par(ll u) { if (u==par[u]) return u; return par[u]=find_par(par[u]); } ll n; void initialize(int n1) { n=n1; for (int i=1;i<=n;i++) { par[i]=i; for (int j=1;j<=n;j++) { if (i!=j) val[i][j]=1; } } } int hasEdge(int u, int v) { u++; v++; u=find_par(u); v=find_par(v); if (u==v) { return 0; } else { if (val[u][v]==1) { for (int t=1;t<=n;t++) { if (t==find_par(t)&&t!=u&&t!=v) { ll h=val[u][t]+val[v][t]; val[u][t]=h; val[t][u]=h; } } par[v]=u; return 1; } else { val[u][v]--; val[v][u]--; return 0; } } } /*int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen("t.inp","r")) { freopen("test.inp","r",stdin); freopen("test.out","w",stdout); } ll n; cin>>n; initialize(n); for (int i=1;i<=n;i++) { } }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...