제출 #946901

#제출 시각아이디문제언어결과실행 시간메모리
946901penguin133Meetings (JOI19_meetings)C++17
0 / 100
1812 ms16468 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); #include "meetings.h" int par[2005]; int getr(int x){return par[x] == x ? x : par[x] = getr(par[x]);} void merge(int a, int b){ a = getr(a); b =getr(b); par[b] = a; } void Solve(int N) { int adj[N][N]; for(int i = 0; i < N; i++)for(int j = 0; j < N; j++)adj[i][j] = 0; for(int i = 0; i < N; i++)par[i] = i; for(int i = 0; i < N; i++){ for(int j = i + 1; j < N; j++){ if(getr(i) == getr(j) || adj[i][j])continue; bool f = 1; for(int k = 0; k < N; k++){ if(k == i || k == j)continue; int res = Query(i, j, k); if(res == k)f = 0; else if(res == i)adj[j][k] = adj[k][j] = 1; else if(res == j)adj[i][k] = adj[k][i] = 1; } if(f)cout << i << ' ' << j << '\n', Bridge(i, j), merge(i, j); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...