# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262103 | 2020-08-12T10:57:35 Z | doowey | Meetings (JOI19_meetings) | C++14 | 2000 ms | 512 KB |
#include "meetings.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n; const int MAXN = 2020; int par[MAXN]; vector<int> mergesort(vector<int> a){ if(a.size() == 1) return a; int mid = (int)a.size()/2; vector<int> lef, rig; for(int i = 0 ; i < a.size(); i ++ ){ if(i < mid) lef.push_back(a[i]); else rig.push_back(a[i]); } lef = mergesort(lef); rig = mergesort(rig); vector<int> srt; int p = 0; for(int i = 0 ; i < lef.size(); i ++ ){ while(p < rig.size() && Query(0, lef[i], rig[p]) == rig[p]){ srt.push_back(rig[p]); p ++ ; } srt.push_back(lef[i]); } while(p < rig.size()){ srt.push_back(rig[p]); p ++ ; } return srt; } void Solve(int N) { n = N; vector<int> ord; for(int i = 1; i < n ; i ++ ){ ord.push_back(i); par[i] = -1; } random_shuffle(ord.begin(), ord.end()); for(auto nd : ord){ if(par[nd] != -1) continue; set<int> gt; int res; for(int j = 1; j < n; j ++ ){ if(j == nd) continue; res = Query(0, j, nd); gt.insert(res); } gt.insert(nd); vector<int> ss; for(auto p : gt) if(p != 0)ss.push_back(p); ss = mergesort(ss); par[ss[0]] = 0; for(int i = 1; i < ss.size(); i ++ ) par[ss[i]] = ss[i - 1]; } for(int i = 1; i < n; i ++ ){ Bridge(par[i], i); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Wrong Answer [3] |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Wrong Answer [3] |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Wrong Answer [3] |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3069 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |