제출 #203405

#제출 시각아이디문제언어결과실행 시간메모리
203405mathking1021Meetings (JOI19_meetings)C++14
29 / 100
238 ms1528 KiB
#include "meetings.h" #include <vector> #include <queue> using namespace std; int a[305][305]; bool v[305][305]; int b[305]; bool vv[305]; queue<int> qu; void Solve(int N) { int n = N; for(int i = 1; i < n; i++) { for(int j = i + 1; j < n; j++) { a[j][i] = a[i][j] = Query(0, i, j); v[a[i][j]][i] = true; v[a[i][j]][j] = true; } } for(int i = 1; i < n; i++) v[0][i] = true; for(int i = 0; i < n; i++) { vv[i] = true; for(int j = 0; j < n; j++) { if(i != j)b[i] += v[i][j]; } if(b[i] == 0) qu.push(i); } while(!qu.empty()) { int t = qu.front(); qu.pop(); for(int i = 0; i < n; i++) { if(vv[i] && i != t && v[t][i]) vv[i] = false, Bridge(min(i, t), max(i, t)); } for(int i = 0; i < n; i++) { if(i == t) continue; if(v[i][t]) { b[i]--; if(b[i] == 0) qu.push(i); } } } // for(int i = 0; i < n; i++) // { // for(int j = i + 1; j < n; j++) // { // bool vv = false; // for(int k = 0; k < n; k++) // { // if(i == k || j == k) continue; // int t = Query(i, j, k); // if(t != i && t != j) {vv = true;break;} // } // if(!vv) Bridge(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...