# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1034458 |
2024-07-25T14:00:33 Z |
Blagoj |
Minerals (JOI19_minerals) |
C++17 |
|
139 ms |
262144 KB |
#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
int val;
bool get(int x) {
int otherVal = Query(x);
swap(val, otherVal);
return val != otherVal;
}
void solve(vector<int> l, vector<int> r, int t) {
int sz = l.size();
if (sz == 1) {
Answer(l[0], r[0]);
return;
}
vector<int> l1, l2, r1, r2;
int mid = sz * (0.4);
for (int i = 0; i < mid; i++) {
get(l[i]);
l1.push_back(l[i]);
}
for (int i = mid; i < sz; i++) r1.push_back(l[i]);
for (int i = 0; i < sz; i++) {
if (l1.size() == l2.size()) r2.push_back(r[i]);
else if (r1.size() == r2.size()) l2.push_back(r[i]);
else if (get(r[i]) == t) l2.push_back(r[i]);
else r2.push_back(r[i]);
}
solve(l1, l2, !t);
solve(r1, r2, t);
}
void Solve(int N) {
vector<int> l, r;
for (int i = 1; i <= 2 * N; i++) {
if (get(i)) l.push_back(i);
else r.push_back(i);
}
solve(l, r, 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
139 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
127 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |