# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1066116 |
2024-08-19T15:10:09 Z |
Andrey |
Meetings (JOI19_meetings) |
C++14 |
|
1026 ms |
1360 KB |
#include "meetings.h"
#include<bits/stdc++.h>
using namespace std;
mt19937 rng(69420);
vector<pair<int,int>> ans(0);
void dude(vector<int> haha) {
if(haha.size() == 1) {
return;
}
if(haha.size() == 2) {
ans.push_back({haha[0],haha[1]});
return;
}
random_shuffle(haha.begin(),haha.end());
int p = rng()%haha.size();
vector<vector<int>> idk(0);
vector<int> troll(0);
for(int i = 0; i < haha.size(); i++) {
if(i != p) {
bool yeah = true;
for(int j = 0; j < troll.size(); j++) {
if(troll[j] == haha[i]) {
yeah = false;
idk[j].push_back(haha[i]);
break;
}
else {
int c = Query(haha[p],troll[j],haha[i]);
if(c != haha[p]) {
yeah = false;
idk[j].push_back(haha[i]);
troll[j] = c;
break;
}
}
}
if(yeah) {
idk.push_back({haha[i]});
troll.push_back(haha[i]);
}
}
}
for(int i = 0; i < idk.size(); i++) {
ans.push_back({haha[p],troll[i]});
dude(idk[i]);
}
}
void Solve(int n) {
vector<int> haha(0);
for(int i = 0; i < n; i++) {
haha.push_back(i);
}
dude(haha);
for(int i = 0; i < ans.size(); i++) {
Bridge(min(ans[i].first,ans[i].second),max(ans[i].first,ans[i].second));
}
}
Compilation message
meetings.cpp: In function 'void dude(std::vector<int>)':
meetings.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | for(int i = 0; i < haha.size(); i++) {
| ~~^~~~~~~~~~~~~
meetings.cpp:23:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(int j = 0; j < troll.size(); j++) {
| ~~^~~~~~~~~~~~~~
meetings.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | for(int i = 0; i < idk.size(); i++) {
| ~~^~~~~~~~~~~~
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:57:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | for(int i = 0; i < ans.size(); i++) {
| ~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 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 |
0 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 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 |
0 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 |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 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 |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 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 |
0 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 |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 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 |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
13 ms |
516 KB |
Output is correct |
28 |
Correct |
8 ms |
344 KB |
Output is correct |
29 |
Correct |
12 ms |
600 KB |
Output is correct |
30 |
Correct |
15 ms |
604 KB |
Output is correct |
31 |
Correct |
14 ms |
600 KB |
Output is correct |
32 |
Correct |
16 ms |
580 KB |
Output is correct |
33 |
Correct |
35 ms |
600 KB |
Output is correct |
34 |
Correct |
37 ms |
600 KB |
Output is correct |
35 |
Correct |
23 ms |
624 KB |
Output is correct |
36 |
Correct |
8 ms |
532 KB |
Output is correct |
37 |
Correct |
6 ms |
344 KB |
Output is correct |
38 |
Correct |
6 ms |
344 KB |
Output is correct |
39 |
Correct |
7 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1026 ms |
1360 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |