#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
int n;
void rjesi (vector <int> v) {
if (v.size() < 2) return;
random_shuffle(v.begin(), v.end());
int a = v[0], b = v[1];
vector <int> lef, rig;
lef.push_back(a); rig.push_back(b);
for (int i=2; i<v.size(); i++) {
int val = Query(a, b, v[i]);
if (val == a) {
lef.push_back(v[i]);
} else if (val == b) {
rig.push_back(v[i]);
} else {
if (lef.size() < rig.size()) {
a = val;
lef.push_back(a);
} else {
b = val;
rig.push_back(b);
}
}
}
if (a > b) swap(a, b);
Bridge(a, b);
rjesi(lef);
rjesi(rig);
}
void Solve (int N) {
n = N;
vector <int> e;
for (int i=0; i<n; i++) {
e.push_back(i);
}
rjesi(e);
}
Compilation message
meetings.cpp: In function 'void rjesi(std::vector<int>)':
meetings.cpp:15:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=2; i<v.size(); i++) {
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Incorrect |
2 ms |
256 KB |
Wrong Answer [1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
512 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |