Submission #497497

#TimeUsernameProblemLanguageResultExecution timeMemory
497497minhcoolMeetings (JOI19_meetings)C++17
29 / 100
2702 ms688 KiB
#include "meetings.h" #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define foru(i, l, r) for(int i = l; i <= r; i++) #define ford(i, r, l) for(int i = r; i >= l; i--) #define eb emplace_back typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 2e3 + 5, MAXN = 1e7 + 5; const long long oo = 1e9 + 7, mod = 1e9 + 7; vector<int> vis[N]; int sz[N]; void Solve(int n){ for(int i = 1; i < n; i++){ for(int j = i + 1; j < n; j++){ int temp = Query(0, i, j); if(temp == i){ //se[j].insert(i); sz[j]++; vis[i].pb(j); } if(temp == j){ sz[i]++; vis[j].pb(i); } } } for(int i = 1; i < n; i++){ sz[i]++; vis[0].pb(i); } queue<int> que; que.push(0); while(!que.empty()){ int u = que.front(); que.pop(); //cout << u << "\n"; for(auto it : vis[u]){ sz[it]--; //cout << it << " " << sz[it] << "\n"; if(!sz[it]){ Bridge(min(u, it), max(u, it)); que.push(it); } } } } /* 5 0 1 0 2 1 3 1 4 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...