Submission #249439

#TimeUsernameProblemLanguageResultExecution timeMemory
249439cheehengMeetings (JOI19_meetings)C++14
29 / 100
3058 ms9136 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; int lca[2005][2005]; void dfs(int u, vector<int> possible){ set<int> impossible; for(int v: possible){ if(impossible.find(v) != impossible.end()){continue;} bool boleh = true; for(int x: possible){ if(lca[v][x] == v){ impossible.insert(x); }else if(lca[v][x] == u){ }else{ boleh = false; break; } } if(boleh){ vector<int> possible2; for(int x: possible){ if(lca[v][x] == v && v != x){ possible2.push_back(x); } } Bridge(min(u, v), max(u, v)); dfs(v, possible2); }else{ impossible.insert(v); } } } void Solve(int N) { lca[0][0] = 0; for(int i = 1; i < N; i ++){ lca[0][i] = 0; lca[i][0] = 0; } for(int i = 1; i < N; i ++){ lca[i][i] = i; for(int j = i+1; j < N; j ++){ lca[i][j] = Query(0, i, j); lca[j][i] = lca[i][j]; } } vector<int> possible; for(int i = 1; i < N; i ++){ possible.push_back(i); } dfs(0, possible); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...