제출 #249486

#제출 시각아이디문제언어결과실행 시간메모리
249486lycMeetings (JOI19_meetings)C++14
0 / 100
3075 ms6552 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " :: " << x << endl #define _ << " " << #define FOR(i,a,b) for(int i=(a);i<=(b);++i) #define RFOR(i,a,b) for(int i=(a);i>=(b);--i) #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(),(x).end() using ii=pair<int,int>; map<ii,int> memo; int ask(int a, int b) { if (memo.count(ii(a,b))) return memo[ii(a,b)]; return memo[ii(a,b)] = Query(0,a,b); } int ind[2005]; vector<int> al[2005]; void Solve(int N) { FOR(i,1,N-1) FOR(j,i+1,N-1) { int r = ask(i,j); if (r != 0) al[0].push_back(r), ++ind[r]; if (r != i) al[r].push_back(i), ++ind[i]; if (r != j) al[r].push_back(j), ++ind[j]; } queue<int> q; q.push(0); while (!q.empty()) { int u = q.front(); q.pop(); for (int v : al[u]) { if (--ind[v] == 0) { q.push(v); Bridge(u,v); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...