#ifdef EVAL
#else
#include"grader.cpp"
#endif
#include"meetings.h"
#include<bits/stdc++.h>
using namespace std;
void add(int x,int y){
if(x>y)swap(x,y);
Bridge(x,y);
}
void go(vector<int>v){
if(v.size()<2)return;
//random_shuffle(v.begin(),v.end());
map<int,vector<int>>m;
m[v[0]].push_back(v[0]);
m[v[1]].push_back(v[1]);
vector<int>path;
for(int i=2;i<v.size();i++){
int x=Query(v[0],v[1],v[i]);
if(!m.count(x))path.push_back(x);
m[x].push_back(v[i]);
}
sort(path.begin(),path.end(),[&](int l,int r){return Query(v[0],l,r)==l;});
int last=v[0];
for(int x:path)add(last,x),last=x;
add(last,v[1]);
for(auto it:m)go(it.second);
}
void Solve(int n){
//srand(time(0));
vector<int>all(n);
iota(all.begin(),all.end(),0);
go(all);
}
Compilation message
meetings.cpp: In function 'void go(std::vector<int>)':
meetings.cpp:19:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | for(int i=2;i<v.size();i++){
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
0 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |
11 |
Correct |
0 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
0 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |
11 |
Correct |
0 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
1 ms |
364 KB |
Output is correct |
21 |
Correct |
1 ms |
364 KB |
Output is correct |
22 |
Correct |
1 ms |
396 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
364 KB |
Output is correct |
25 |
Correct |
1 ms |
364 KB |
Output is correct |
26 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
0 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |
11 |
Correct |
0 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
1 ms |
364 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Correct |
1 ms |
364 KB |
Output is correct |
21 |
Correct |
1 ms |
364 KB |
Output is correct |
22 |
Correct |
1 ms |
396 KB |
Output is correct |
23 |
Correct |
1 ms |
364 KB |
Output is correct |
24 |
Correct |
1 ms |
364 KB |
Output is correct |
25 |
Correct |
1 ms |
364 KB |
Output is correct |
26 |
Correct |
2 ms |
364 KB |
Output is correct |
27 |
Correct |
5 ms |
364 KB |
Output is correct |
28 |
Correct |
5 ms |
364 KB |
Output is correct |
29 |
Correct |
7 ms |
364 KB |
Output is correct |
30 |
Correct |
7 ms |
364 KB |
Output is correct |
31 |
Correct |
5 ms |
364 KB |
Output is correct |
32 |
Correct |
8 ms |
364 KB |
Output is correct |
33 |
Correct |
10 ms |
492 KB |
Output is correct |
34 |
Correct |
13 ms |
492 KB |
Output is correct |
35 |
Correct |
12 ms |
492 KB |
Output is correct |
36 |
Correct |
6 ms |
364 KB |
Output is correct |
37 |
Correct |
9 ms |
492 KB |
Output is correct |
38 |
Correct |
12 ms |
476 KB |
Output is correct |
39 |
Correct |
177 ms |
1132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
423 ms |
876 KB |
Output is correct |
2 |
Correct |
539 ms |
748 KB |
Output is correct |
3 |
Correct |
474 ms |
728 KB |
Output is correct |
4 |
Correct |
459 ms |
748 KB |
Output is correct |
5 |
Correct |
382 ms |
620 KB |
Output is correct |
6 |
Correct |
383 ms |
876 KB |
Output is correct |
7 |
Correct |
607 ms |
708 KB |
Output is correct |
8 |
Correct |
570 ms |
736 KB |
Output is correct |
9 |
Correct |
574 ms |
816 KB |
Output is correct |
10 |
Correct |
583 ms |
852 KB |
Output is correct |
11 |
Correct |
616 ms |
748 KB |
Output is correct |
12 |
Correct |
356 ms |
872 KB |
Output is correct |
13 |
Correct |
241 ms |
876 KB |
Output is correct |
14 |
Correct |
572 ms |
780 KB |
Output is correct |
15 |
Correct |
346 ms |
756 KB |
Output is correct |
16 |
Correct |
464 ms |
776 KB |
Output is correct |
17 |
Correct |
901 ms |
1012 KB |
Output is correct |
18 |
Execution timed out |
2586 ms |
2000 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |