# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119196 | 2019-06-20T15:57:15 Z | KLPP | Meetings (JOI19_meetings) | C++14 | 643 ms | 1680 KB |
#include "meetings.h" #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) vector<pair<int,int> >edges; int PNT; bool cmp(int a, int b){ if(Query(PNT,a,b)==a)return true; return false; } void solve(vector<int> v){ if(v.size()==1)return; if(v.size()==2){ sort(v.begin(),v.end()); //cout<<v[0]<<" "<<v[1]<<endl; Bridge(v[0],v[1]); return; } random_shuffle(v.begin(),v.end()); int x=v[0]; int y=v[1]; //cout<<x<<" "<<y<<endl; int answer[v.size()]; answer[0]=-1; answer[1]=-1; map<int,vector<int> >m; rep(i,0,v.size()){ vector<int> N; m[i]=N; } rep(i,2,v.size()){ answer[i]=Query(x,y,v[i]); //cout<<answer[i]<<" "<<v[i]<<" "<<x<<" "<<y<<endl; m[answer[i]].push_back(v[i]); } m[x].push_back(x); m[y].push_back(y); set<int> line; line.insert(y); trav(p,m){ //cout<<p.first<<" "<<p.second.size()<<" "<<x<<" "<<y<<endl; if(p.second.size()>0){ solve(p.second); if(p.first!=x)line.insert(p.first); } } line.erase(x); vector<int> Line; trav(a,line)Line.push_back(a); PNT=x; sort(Line.begin(),Line.end(),cmp); reverse(Line.begin(),Line.end()); Line.push_back(x); rep(i,0,Line.size()-1){ //cout<<Line[i]<<" "<<Line[i+1]<<endl; Bridge(min(Line[i],Line[i+1]),max(Line[i],Line[i+1])); } } void Solve(int N) { vector<int> test; rep(i,0,N)test.push_back(i); solve(test); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 304 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 304 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 256 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 256 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
22 | Correct | 2 ms | 384 KB | Output is correct |
23 | Correct | 7 ms | 384 KB | Output is correct |
24 | Correct | 2 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 304 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 256 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 256 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Correct | 2 ms | 384 KB | Output is correct |
22 | Correct | 2 ms | 384 KB | Output is correct |
23 | Correct | 7 ms | 384 KB | Output is correct |
24 | Correct | 2 ms | 384 KB | Output is correct |
25 | Correct | 2 ms | 384 KB | Output is correct |
26 | Correct | 2 ms | 256 KB | Output is correct |
27 | Correct | 6 ms | 512 KB | Output is correct |
28 | Correct | 6 ms | 512 KB | Output is correct |
29 | Correct | 5 ms | 384 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 5 ms | 512 KB | Output is correct |
32 | Correct | 6 ms | 384 KB | Output is correct |
33 | Correct | 9 ms | 512 KB | Output is correct |
34 | Correct | 10 ms | 640 KB | Output is correct |
35 | Correct | 9 ms | 640 KB | Output is correct |
36 | Correct | 5 ms | 512 KB | Output is correct |
37 | Correct | 8 ms | 512 KB | Output is correct |
38 | Correct | 9 ms | 384 KB | Output is correct |
39 | Correct | 10 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 541 ms | 864 KB | Output is correct |
2 | Correct | 565 ms | 1028 KB | Output is correct |
3 | Correct | 589 ms | 1068 KB | Output is correct |
4 | Correct | 638 ms | 1572 KB | Output is correct |
5 | Correct | 325 ms | 760 KB | Output is correct |
6 | Correct | 285 ms | 1016 KB | Output is correct |
7 | Correct | 540 ms | 1144 KB | Output is correct |
8 | Correct | 443 ms | 1132 KB | Output is correct |
9 | Correct | 474 ms | 1380 KB | Output is correct |
10 | Correct | 432 ms | 1400 KB | Output is correct |
11 | Correct | 489 ms | 1272 KB | Output is correct |
12 | Correct | 424 ms | 972 KB | Output is correct |
13 | Correct | 349 ms | 1016 KB | Output is correct |
14 | Correct | 326 ms | 1144 KB | Output is correct |
15 | Correct | 294 ms | 920 KB | Output is correct |
16 | Correct | 328 ms | 1044 KB | Output is correct |
17 | Correct | 503 ms | 1272 KB | Output is correct |
18 | Correct | 330 ms | 1272 KB | Output is correct |
19 | Correct | 350 ms | 1012 KB | Output is correct |
20 | Correct | 293 ms | 1016 KB | Output is correct |
21 | Correct | 411 ms | 1408 KB | Output is correct |
22 | Correct | 429 ms | 1068 KB | Output is correct |
23 | Correct | 368 ms | 1016 KB | Output is correct |
24 | Correct | 341 ms | 1016 KB | Output is correct |
25 | Correct | 417 ms | 1104 KB | Output is correct |
26 | Correct | 364 ms | 1172 KB | Output is correct |
27 | Correct | 467 ms | 1120 KB | Output is correct |
28 | Correct | 528 ms | 1400 KB | Output is correct |
29 | Correct | 413 ms | 1400 KB | Output is correct |
30 | Correct | 527 ms | 1680 KB | Output is correct |
31 | Correct | 515 ms | 1500 KB | Output is correct |
32 | Correct | 643 ms | 1016 KB | Output is correct |
33 | Correct | 541 ms | 1272 KB | Output is correct |
34 | Correct | 6 ms | 512 KB | Output is correct |
35 | Correct | 5 ms | 512 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 512 KB | Output is correct |
38 | Correct | 6 ms | 512 KB | Output is correct |
39 | Correct | 6 ms | 384 KB | Output is correct |
40 | Correct | 9 ms | 512 KB | Output is correct |
41 | Correct | 10 ms | 640 KB | Output is correct |
42 | Correct | 10 ms | 640 KB | Output is correct |
43 | Correct | 5 ms | 512 KB | Output is correct |
44 | Correct | 8 ms | 512 KB | Output is correct |
45 | Correct | 9 ms | 384 KB | Output is correct |
46 | Correct | 10 ms | 384 KB | Output is correct |
47 | Correct | 2 ms | 384 KB | Output is correct |
48 | Correct | 2 ms | 384 KB | Output is correct |
49 | Correct | 2 ms | 384 KB | Output is correct |
50 | Correct | 2 ms | 384 KB | Output is correct |
51 | Correct | 2 ms | 256 KB | Output is correct |
52 | Correct | 2 ms | 384 KB | Output is correct |
53 | Correct | 2 ms | 384 KB | Output is correct |
54 | Correct | 2 ms | 384 KB | Output is correct |
55 | Correct | 2 ms | 384 KB | Output is correct |
56 | Correct | 2 ms | 384 KB | Output is correct |
57 | Correct | 2 ms | 384 KB | Output is correct |
58 | Correct | 2 ms | 384 KB | Output is correct |
59 | Correct | 2 ms | 384 KB | Output is correct |
60 | Correct | 2 ms | 384 KB | Output is correct |
61 | Correct | 2 ms | 256 KB | Output is correct |
62 | Correct | 2 ms | 256 KB | Output is correct |
63 | Correct | 2 ms | 256 KB | Output is correct |
64 | Correct | 2 ms | 384 KB | Output is correct |
65 | Correct | 2 ms | 256 KB | Output is correct |
66 | Correct | 2 ms | 384 KB | Output is correct |
67 | Correct | 2 ms | 384 KB | Output is correct |
68 | Correct | 2 ms | 256 KB | Output is correct |
69 | Correct | 2 ms | 384 KB | Output is correct |
70 | Correct | 2 ms | 256 KB | Output is correct |
71 | Correct | 2 ms | 256 KB | Output is correct |
72 | Correct | 2 ms | 384 KB | Output is correct |