# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
792247 | 2023-07-24T21:05:58 Z | beaconmc | Minerals (JOI19_minerals) | C++14 | 19 ms | 3708 KB |
#include "minerals.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i, x, y) for(ll i=x; i<y; i++) #define FORNEG(i, x, y) for(ll i=x; i>y; i--) #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL) std::vector<ll> machine; void empty(){ using namespace std; for (auto&i : machine){ Query(i); } machine.clear(); } void Solve(int N) { using namespace std; vector<vector<ll>> top; vector<vector<ll>> bot; top.push_back({}); bot.push_back({}); ll cur = 0; FOR(i,1, 2*N+1){ machine.push_back(i); ll result = Query(i); if (result == cur + 1){ cur++; top[0].push_back(i); }else{ Query(i); machine.pop_back(); bot[0].push_back(i); } } empty(); while (!(top.size() == bot.size() && bot.size() == N)){ vector<vector<ll>> temp; for (auto&i : bot){ if (i.size() == 1){ temp.push_back(i); continue; } vector<ll> temp2; FOR(j,0,i.size()/2){ temp2.push_back(i[j]); } temp.push_back(temp2); temp2.clear(); FOR(j, i.size()/2, i.size()){ temp2.push_back(i[j]); } temp.push_back(temp2); } bot = temp; temp.clear(); ll ind = 0; FOR(i,0,top.size()){ if (top[i].size() == 1){ ind += 1; temp.push_back(top[i]); continue; } empty(); vector<ll> first; vector<ll> second; ll curval = 0; for (auto&j : bot[ind]){ curval = Query(j); machine.push_back(j); } for (auto&j : top[i]){ ll result = Query(j); machine.push_back(j); if (result > curval){ machine.pop_back(); Query(j); second.push_back(j); }else{ first.push_back(j); } } temp.push_back(first); temp.push_back(second); ind += 2; } top = temp; empty(); } FOR(i,0,N){ Answer((int) top[i][0],(int) bot[i][0]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 464 KB | Output is correct |
2 | Correct | 2 ms | 720 KB | Output is correct |
3 | Correct | 4 ms | 1232 KB | Output is correct |
4 | Correct | 9 ms | 2000 KB | Output is correct |
5 | Correct | 16 ms | 3612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
15 | Incorrect | 19 ms | 2860 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
15 | Incorrect | 19 ms | 2860 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
15 | Incorrect | 19 ms | 2860 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
15 | Incorrect | 19 ms | 2860 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
15 | Incorrect | 19 ms | 2860 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 220 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 464 KB | Output is correct |
6 | Correct | 2 ms | 720 KB | Output is correct |
7 | Correct | 4 ms | 1232 KB | Output is correct |
8 | Correct | 9 ms | 2000 KB | Output is correct |
9 | Correct | 16 ms | 3612 KB | Output is correct |
10 | Correct | 2 ms | 464 KB | Output is correct |
11 | Correct | 12 ms | 2676 KB | Output is correct |
12 | Correct | 15 ms | 3620 KB | Output is correct |
13 | Correct | 13 ms | 3708 KB | Output is correct |
14 | Correct | 14 ms | 3680 KB | Output is correct |
15 | Incorrect | 19 ms | 2860 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |