# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
456183 |
2021-08-06T08:20:23 Z |
grt |
Sob (COCI19_sob) |
C++17 |
|
329 ms |
19088 KB |
#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
void solve(vi &a, vi &b, int dep) {
if((int)a.size() <= 1 && (int)b.size() <= 1) {
if((int)a.size() == 1 && (int)b.size() == 1) {
cout << a[0] << " " << b[0] << "\n";
}
return;
}
vi odda, evena, oddb, evenb;
for(int i = 0; i < (int)a.size(); ++i) {
if(a[i] & (1 << dep)) {
odda.PB(a[i]);
} else {
evena.PB(a[i]);
}
}
for(int i = 0; i < (int)b.size(); ++i) {
if(b[i] & (1 << dep)) {
oddb.PB(b[i]);
} else {
evenb.PB(b[i]);
}
}
if(odda.size() != oddb.size()) {
odda.PB(evena.back());
evena.pop_back();
}
solve(evena, evenb, dep + 1);
solve(odda, oddb, dep + 1);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vi l(n), r(n);
for(int i = 0; i < n; ++i) {
l[i] = i;
r[i] = m + i;
}
solve(l, r, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
165 ms |
10012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
150 ms |
10000 KB |
Output is correct |
7 |
Correct |
72 ms |
4972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
165 ms |
10012 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
150 ms |
10000 KB |
Output is correct |
11 |
Correct |
72 ms |
4972 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
34 ms |
2300 KB |
Output is correct |
20 |
Correct |
117 ms |
7864 KB |
Output is correct |
21 |
Correct |
6 ms |
572 KB |
Output is correct |
22 |
Correct |
2 ms |
332 KB |
Output is correct |
23 |
Correct |
176 ms |
11536 KB |
Output is correct |
24 |
Correct |
329 ms |
19088 KB |
Output is correct |
25 |
Correct |
292 ms |
18820 KB |
Output is correct |