답안 #897622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897622 2024-01-03T13:45:02 Z ttamx Meetings (JOI19_meetings) C++14
100 / 100
673 ms 1244 KB
#include "meetings.h"
#include<bits/stdc++.h>

using namespace std;

void Solve(int n){
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	vector<vector<int>> comp(n);
	for(int i=1;i<n;i++)comp[0].emplace_back(i);
	auto link=[&](int u,int v){
		if(u>v)swap(u,v);
		Bridge(u,v);
	};
	function<void(int)> dnc=[&](int s){
		int sz=comp[s].size();
		if(!sz)return;
		vector<int> res,path{s};
		swap(res,comp[s]);
		int t=res[rng()%sz];
		for(auto u:res)if(u!=t){
			int v=Query(s,t,u);
			if(u==v)path.emplace_back(u);
			else comp[v].emplace_back(u);
		}
		sort(path.begin()+1,path.end(),[&](int l,int r){
			return Query(s,l,r)==l;
		});
		path.emplace_back(t);
		for(int i=1;i<path.size();i++)link(path[i-1],path[i]);
		for(auto u:path)dnc(u);
	};
	dnc(0);
}

Compilation message

meetings.cpp: In lambda function:
meetings.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   for(int i=1;i<path.size();i++)link(path[i-1],path[i]);
      |               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 4 ms 340 KB Output is correct
28 Correct 4 ms 532 KB Output is correct
29 Correct 4 ms 344 KB Output is correct
30 Correct 4 ms 344 KB Output is correct
31 Correct 3 ms 344 KB Output is correct
32 Correct 4 ms 344 KB Output is correct
33 Correct 7 ms 344 KB Output is correct
34 Correct 9 ms 528 KB Output is correct
35 Correct 9 ms 344 KB Output is correct
36 Correct 3 ms 344 KB Output is correct
37 Correct 12 ms 540 KB Output is correct
38 Correct 8 ms 600 KB Output is correct
39 Correct 6 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 277 ms 712 KB Output is correct
2 Correct 237 ms 708 KB Output is correct
3 Correct 246 ms 600 KB Output is correct
4 Correct 259 ms 884 KB Output is correct
5 Correct 230 ms 752 KB Output is correct
6 Correct 171 ms 844 KB Output is correct
7 Correct 461 ms 808 KB Output is correct
8 Correct 466 ms 996 KB Output is correct
9 Correct 438 ms 848 KB Output is correct
10 Correct 465 ms 1008 KB Output is correct
11 Correct 472 ms 1244 KB Output is correct
12 Correct 197 ms 848 KB Output is correct
13 Correct 176 ms 732 KB Output is correct
14 Correct 286 ms 1012 KB Output is correct
15 Correct 229 ms 728 KB Output is correct
16 Correct 264 ms 724 KB Output is correct
17 Correct 518 ms 848 KB Output is correct
18 Correct 209 ms 768 KB Output is correct
19 Correct 246 ms 1244 KB Output is correct
20 Correct 274 ms 600 KB Output is correct
21 Correct 264 ms 600 KB Output is correct
22 Correct 245 ms 600 KB Output is correct
23 Correct 253 ms 724 KB Output is correct
24 Correct 230 ms 1104 KB Output is correct
25 Correct 252 ms 600 KB Output is correct
26 Correct 230 ms 784 KB Output is correct
27 Correct 270 ms 860 KB Output is correct
28 Correct 491 ms 716 KB Output is correct
29 Correct 400 ms 804 KB Output is correct
30 Correct 409 ms 600 KB Output is correct
31 Correct 444 ms 600 KB Output is correct
32 Correct 673 ms 800 KB Output is correct
33 Correct 402 ms 784 KB Output is correct
34 Correct 4 ms 344 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
36 Correct 4 ms 344 KB Output is correct
37 Correct 4 ms 344 KB Output is correct
38 Correct 3 ms 344 KB Output is correct
39 Correct 4 ms 536 KB Output is correct
40 Correct 7 ms 344 KB Output is correct
41 Correct 10 ms 344 KB Output is correct
42 Correct 8 ms 344 KB Output is correct
43 Correct 3 ms 344 KB Output is correct
44 Correct 6 ms 532 KB Output is correct
45 Correct 6 ms 344 KB Output is correct
46 Correct 6 ms 344 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 344 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 344 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 344 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 0 ms 344 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 0 ms 344 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 0 ms 344 KB Output is correct
69 Correct 0 ms 344 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 0 ms 344 KB Output is correct
72 Correct 0 ms 344 KB Output is correct