# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
344272 | 2021-01-05T11:18:40 Z | amunduzbaev | Meetings (JOI19_meetings) | C++14 | 0 ms | 0 KB |
/** made by amunduzbaev **/ #include "meetings.h" #include <bits/stdc++.h> using namespace std; #include "grader.cpp" #define ff first #define ss second #define pb push_back #define mp make_pair #define ub upper_bound #define lb lower_bound #define ll long long #define ld long double #define pii pair<int, int> #define pll pair<ll, ll> #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(),x.rend() #define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define vll vector<ll> #define vii vector<int> #define vpii vector<pii> #define vpll vector<pll> #define cnt(a)__builtin_popcount(a) template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;} template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;} const int N = 2e5+5; const int mod = 1e9+7; const ll inf = 1e18; const ld Pi = acos(-1); void Solve(int n){ vector<vector<int>> pp(n, vector<int>(n, 0)); vector<set<int>> par(n); vector<vector<int>> used(n, vector<int>(n, 0)); queue<pii> qq; int cur = 0; bool ok = 1; while(ok){ ok = 0; for(int i=0;i<n;i++){ //bool ok = 0; for(int j=i+1;j<n;j++){ cur = 0; if(i == cur || j == cur) cur = 1; if(i == cur || j == cur) cur = 2; if(i == j || used[j][i] || used[i][j] || i == cur || j == cur) continue; int tt = Query(i, j, cur); while(j != tt && i != tt && cur != tt){ cur = tt; tt = Query(cur, i, j); }if(tt == cur) continue; par[j].insert(i); used[i][j] = 1; ok = 1; //break; }//}if(ok) break; } } cout<<"\n"; for(int i=0;i<n;i++){ for(auto x = par[i].begin(); x != par[i].end(); x++){ int cur = *x; bool ok = 1; for(auto tx = par[i].begin(); tx != par[i].end(); tx++){ //int sp = *tx; if(par[*tx].find(cur) != par[*tx].end()){ ok = 0; break; } }if(!ok) continue; //cout<<i<<" "<<cur<<"\n"; Bridge(cur, i); } } } /* 8 1 2 1 4 0 1 0 3 0 5 5 6 3 7 5 0 1 0 2 1 3 1 4 */