# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795268 | 2023-07-27T07:55:50 Z | SlavicG | Minerals (JOI19_minerals) | C++17 | 149 ms | 444 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void Solve(int N) { int B = sqrt(N); deque<int> in; deque<int> order; int prev_ans = 0, ans = 0; for(int i = 1; i <= 2*N; i++){order.push_back(i);} shuffle(order.begin(), order.end(), rng); while(!order.empty()) { ans = prev_ans = in.size(); in.push_back(order.front()); ans = Query(order.front()); order.pop_front(); vector<int> toput; if(ans != prev_ans){ if((int)in.size() > B) { for(auto x: in) { Query(x); toput.push_back(x); } in.clear(); } goto paiu; } while(true) { prev_ans = ans; int now = in.front(); ans = Query(now); in.pop_front(); if(ans != prev_ans) { toput.push_back(now); } else { Query(in.back()); Answer(now, in.back()); in.pop_back(); break; } } paiu:; if(toput.empty()){continue;} int dist = sqrt(N); int idx = dist; for(int i = 0; i < toput.size(); i++) { if(idx >= order.size()) { order.push_back(toput[i]); idx+=dist; continue; } order.insert(order.begin()+idx, toput[i]); idx+=dist; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 336 KB | Output is correct |
2 | Correct | 32 ms | 380 KB | Output is correct |
3 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 336 KB | Output is correct |
6 | Correct | 32 ms | 380 KB | Output is correct |
7 | Incorrect | 149 ms | 444 KB | Wrong Answer [2] |
8 | Halted | 0 ms | 0 KB | - |