# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
417495 | 2021-06-03T19:48:24 Z | iulia2100 | Minerals (JOI19_minerals) | C++14 | 32 ms | 3652 KB |
#include <iostream> #include <vector> #include "minerals.h" using namespace std; //ifstream cin ("idk.in"); //ofstream cout ("idk.out"); const int N = 96005; int last_ans; int q[N]; bool in_set[N]; vector <int> st, dr; void solve(vector <int> v) { if (v.size() == 2) { Answer(v[0], v[1]); return; } // cout << v.size() << '\n'; vector <int> aux_st, aux_dr; int nr = v.size() / 4, x = 0; for (auto it : v) { if (x == nr && in_set[it]) { aux_dr.push_back(it); } else if (in_set[it]) { x = Query(it); q[it] ^= 1; aux_st.push_back(it); } } for (auto it : v) { if (in_set[it]) continue; if (aux_st.size() == nr + nr) { aux_dr.push_back(it); continue; } if (aux_dr.size() == v.size() - nr - nr) { aux_st.push_back(it); continue; } x = Query(it); q[it] ^= 1; if (x > nr) { x = Query(it); q[it] ^= 1; aux_dr.push_back(it); } else aux_st.push_back(it); } for (auto it : aux_st) { if (q[it]) { Query(it); q[it] ^= 1; } } solve(aux_st); solve(aux_dr); } void find_index(int n) { int last = 0; for (int i = 1; i <= n + n; ++i) { int x = Query(i); last_ans = x; if (x == last) { last_ans = Query(i); continue; } in_set[i] = true; last = x; } for (int i = 1; i <= n + n; ++i) { if (!in_set[i]) { dr.push_back(i); } else { st.push_back(i); Query(i); } } } void Solve(int n) { find_index(n); vector <int> aux(0); for (int i = 1; i <= n + n; ++i) aux.push_back(i); solve(aux); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 328 KB | Output is correct |
2 | Correct | 2 ms | 456 KB | Output is correct |
3 | Correct | 5 ms | 584 KB | Output is correct |
4 | Correct | 9 ms | 968 KB | Output is correct |
5 | Correct | 19 ms | 1564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
15 | Incorrect | 32 ms | 3652 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
15 | Incorrect | 32 ms | 3652 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
15 | Incorrect | 32 ms | 3652 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
15 | Incorrect | 32 ms | 3652 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
15 | Incorrect | 32 ms | 3652 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 1 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 2 ms | 456 KB | Output is correct |
7 | Correct | 5 ms | 584 KB | Output is correct |
8 | Correct | 9 ms | 968 KB | Output is correct |
9 | Correct | 19 ms | 1564 KB | Output is correct |
10 | Correct | 1 ms | 328 KB | Output is correct |
11 | Correct | 14 ms | 1144 KB | Output is correct |
12 | Correct | 18 ms | 1608 KB | Output is correct |
13 | Correct | 16 ms | 1584 KB | Output is correct |
14 | Correct | 14 ms | 1512 KB | Output is correct |
15 | Incorrect | 32 ms | 3652 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |