답안 #719764

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
719764 2023-04-06T15:46:58 Z walterw Minerals (JOI19_minerals) C++17
80 / 100
50 ms 3424 KB
#include "minerals.h"
#include <bits/stdc++.h>

using namespace std;

int pre, cur;

void dnc(vector<int> x, vector<int> y, bool bx = true, bool by = true) {
    if (x.size() == 1) {

        Answer(x[0], y[0]);
        return;
    }


    int n = x.size(); int mid = n / 2;

    vector<int> x1, x2;

    for (int i = 0; i < mid; i++) x1.push_back(x[i]);
    for (int i = mid; i < n; i++) x2.push_back(x[i]);

    if (bx) {
        for (int i = mid; i < n; i++) {
            cur = Query(x[i]);
            swap(pre, cur);
        }
    } else {
        for (int i = 0; i < mid; i++) {
            cur = Query(x[i]);
            swap(pre, cur);
        }
    }


    vector<int> v1, v2;

    for (auto c : y) {
        cur = Query(c);
        swap(pre, cur);
        if (pre != cur) {
            v1.push_back(c);
        } else {
            v2.push_back(c);
        }
    }

    dnc(x1, v2, true, !by);
    dnc(x2, v1, false, !by);
}

void Solve(int N) {

    vector<int> v1, v2;

    for (int i = 1; i <= 2 * N; ++i) {
        cur = Query(i);
        swap(cur, pre);
        if (cur != pre) {
            v1.push_back(i);
        } else {
            v2.push_back(i);
        }
    }


    dnc(v1, v2);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 464 KB Output is correct
4 Correct 9 ms 720 KB Output is correct
5 Correct 15 ms 1320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Correct 39 ms 3156 KB Output is correct
16 Correct 41 ms 3152 KB Output is correct
17 Correct 32 ms 3028 KB Output is correct
18 Correct 37 ms 2888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Correct 39 ms 3156 KB Output is correct
16 Correct 41 ms 3152 KB Output is correct
17 Correct 32 ms 3028 KB Output is correct
18 Correct 37 ms 2888 KB Output is correct
19 Correct 44 ms 3164 KB Output is correct
20 Correct 38 ms 3196 KB Output is correct
21 Correct 34 ms 3068 KB Output is correct
22 Correct 33 ms 3016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Correct 39 ms 3156 KB Output is correct
16 Correct 41 ms 3152 KB Output is correct
17 Correct 32 ms 3028 KB Output is correct
18 Correct 37 ms 2888 KB Output is correct
19 Correct 44 ms 3164 KB Output is correct
20 Correct 38 ms 3196 KB Output is correct
21 Correct 34 ms 3068 KB Output is correct
22 Correct 33 ms 3016 KB Output is correct
23 Correct 43 ms 3280 KB Output is correct
24 Correct 50 ms 3240 KB Output is correct
25 Correct 31 ms 3128 KB Output is correct
26 Correct 37 ms 3016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Correct 39 ms 3156 KB Output is correct
16 Correct 41 ms 3152 KB Output is correct
17 Correct 32 ms 3028 KB Output is correct
18 Correct 37 ms 2888 KB Output is correct
19 Correct 44 ms 3164 KB Output is correct
20 Correct 38 ms 3196 KB Output is correct
21 Correct 34 ms 3068 KB Output is correct
22 Correct 33 ms 3016 KB Output is correct
23 Correct 43 ms 3280 KB Output is correct
24 Correct 50 ms 3240 KB Output is correct
25 Correct 31 ms 3128 KB Output is correct
26 Correct 37 ms 3016 KB Output is correct
27 Incorrect 37 ms 3424 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Correct 39 ms 3156 KB Output is correct
16 Correct 41 ms 3152 KB Output is correct
17 Correct 32 ms 3028 KB Output is correct
18 Correct 37 ms 2888 KB Output is correct
19 Correct 44 ms 3164 KB Output is correct
20 Correct 38 ms 3196 KB Output is correct
21 Correct 34 ms 3068 KB Output is correct
22 Correct 33 ms 3016 KB Output is correct
23 Correct 43 ms 3280 KB Output is correct
24 Correct 50 ms 3240 KB Output is correct
25 Correct 31 ms 3128 KB Output is correct
26 Correct 37 ms 3016 KB Output is correct
27 Incorrect 37 ms 3424 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 4 ms 464 KB Output is correct
8 Correct 9 ms 720 KB Output is correct
9 Correct 15 ms 1320 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 10 ms 976 KB Output is correct
12 Correct 15 ms 1316 KB Output is correct
13 Correct 12 ms 1384 KB Output is correct
14 Correct 11 ms 1232 KB Output is correct
15 Correct 39 ms 3156 KB Output is correct
16 Correct 41 ms 3152 KB Output is correct
17 Correct 32 ms 3028 KB Output is correct
18 Correct 37 ms 2888 KB Output is correct
19 Correct 44 ms 3164 KB Output is correct
20 Correct 38 ms 3196 KB Output is correct
21 Correct 34 ms 3068 KB Output is correct
22 Correct 33 ms 3016 KB Output is correct
23 Correct 43 ms 3280 KB Output is correct
24 Correct 50 ms 3240 KB Output is correct
25 Correct 31 ms 3128 KB Output is correct
26 Correct 37 ms 3016 KB Output is correct
27 Incorrect 37 ms 3424 KB Wrong Answer [2]
28 Halted 0 ms 0 KB -