# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
795629 | 2023-07-27T11:50:17 Z | AbdullahMohammedAhmad | Minerals (JOI19_minerals) | C++14 | 21 ms | 4436 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; deque<int> m; void clear_queue() { while(!m.empty()) { Query(m.back()); m.pop_back(); } } void Solve(int N) { vector<vector<int>> prev1(1); vector<vector<int>> prev2(1); for(int i = 1; i <= 2*N; i++) { m.push_back(i); if(Query(i) != m.size()) { prev2[0].push_back(i); Query(i); m.pop_back(); } else { prev1[0].push_back(i); } } clear_queue(); while(prev1.size() < N) { vector<vector<int>> now1; vector<vector<int>> now2; for(int i = 0; i < prev1.size(); i++) { //ONE if(prev1[i].size() == 1) { now1.push_back(prev1[i]); now2.push_back(prev2[i]); continue; } now1.push_back(vector<int>()); now1.push_back(vector<int>()); now2.push_back(vector<int>()); now2.push_back(vector<int>()); for(int j = 0; j < prev1[i].size(); j++) { if(j%2 == 0) { now1[now1.size()-2].push_back(prev1[i][j]); m.push_back(prev1[i][j]); Query(prev1[i][j]); } else { now1[now1.size()-1].push_back(prev1[i][j]); } } for(int j = 0; j < prev2[i].size(); j++) { m.push_back(prev2[i][j]); if(Query(prev2[i][j]) == m.size()) { now2[now2.size()-1].push_back(prev2[i][j]); Query(prev2[i][j]); m.pop_back(); } else { now2[now2.size()-2].push_back(prev2[i][j]); Query(prev2[i][j]); m.pop_back(); } } clear_queue(); } prev1 = now1; prev2 = now2; } for(int i = 0; i < N; i++) { Answer(prev1[i][0], prev2[i][0]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 592 KB | Output is correct |
2 | Correct | 2 ms | 848 KB | Output is correct |
3 | Correct | 7 ms | 1448 KB | Output is correct |
4 | Correct | 8 ms | 2472 KB | Output is correct |
5 | Correct | 18 ms | 4388 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
15 | Incorrect | 21 ms | 2320 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
15 | Incorrect | 21 ms | 2320 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
15 | Incorrect | 21 ms | 2320 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
15 | Incorrect | 21 ms | 2320 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
15 | Incorrect | 21 ms | 2320 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 336 KB | Output is correct |
4 | Correct | 0 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 848 KB | Output is correct |
7 | Correct | 7 ms | 1448 KB | Output is correct |
8 | Correct | 8 ms | 2472 KB | Output is correct |
9 | Correct | 18 ms | 4388 KB | Output is correct |
10 | Correct | 1 ms | 592 KB | Output is correct |
11 | Correct | 12 ms | 3204 KB | Output is correct |
12 | Correct | 18 ms | 4348 KB | Output is correct |
13 | Correct | 16 ms | 4436 KB | Output is correct |
14 | Correct | 16 ms | 4344 KB | Output is correct |
15 | Incorrect | 21 ms | 2320 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |