답안 #167307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167307 2019-12-07T09:13:48 Z ho94949 Minerals (JOI19_minerals) C++17
90 / 100
71 ms 3588 KB
#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;

const int MAXN = 43000;

bool is_in[2*MAXN];
int last = 0;
int Q(int x)
{
    is_in[x] = !is_in[x];
    return last = Query(x);
}


void recur(vector<int> A, vector<int> B)
{
    //for(auto x: A) cout << x << " "; cout << endl;
    //for(auto x: B) cout << x << " "; cout << endl;
    //cout << endl;
    assert(A.size() == B.size());
    int N = A.size();
    assert(N >= 1);
    if(N==1)
    {
        Answer(A[0], B[0]);
        return;
    }

    int M = N/2;
    
    vector<int> fA, fB, sA, sB;
    for(int i=0; i<M; ++i)
    {
        fA.push_back(A[i]);
        Q(A[i]);
    }
    bool is_fA_inside = is_in[A[0]];
    for(int i=M; i<N; ++i)
    {
        sA.push_back(A[i]);
    }
    int i = 0;
    while(fB.size() != fA.size() && sB.size() != sA.size())
    {
        int plast = last;
        Q(B[i]);
        if(is_fA_inside == (last == plast) )
            fB.push_back(B[i]);
        else
            sB.push_back(B[i]);
        ++i;
    }
    while(fB.size() != fA.size()) fB.push_back(B[i++]);
    while(sB.size() != sA.size()) sB.push_back(B[i++]);
    recur(fA, fB);
    recur(sA, sB);    
}


void Solve(int N) {
    vector<int> V, W;
    for(int i=1; i<=2*N; ++i)
    {
        int plast = last;
        Q(i);
        if(last != plast) V.push_back(i);
        else W.push_back(i);
    }
    recur(V, W);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 7 ms 508 KB Output is correct
4 Correct 13 ms 808 KB Output is correct
5 Correct 23 ms 1412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
15 Correct 64 ms 3292 KB Output is correct
16 Correct 67 ms 3272 KB Output is correct
17 Correct 60 ms 3188 KB Output is correct
18 Correct 49 ms 3084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
15 Correct 64 ms 3292 KB Output is correct
16 Correct 67 ms 3272 KB Output is correct
17 Correct 60 ms 3188 KB Output is correct
18 Correct 49 ms 3084 KB Output is correct
19 Correct 66 ms 3320 KB Output is correct
20 Correct 66 ms 3372 KB Output is correct
21 Correct 48 ms 3272 KB Output is correct
22 Correct 49 ms 3032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
15 Correct 64 ms 3292 KB Output is correct
16 Correct 67 ms 3272 KB Output is correct
17 Correct 60 ms 3188 KB Output is correct
18 Correct 49 ms 3084 KB Output is correct
19 Correct 66 ms 3320 KB Output is correct
20 Correct 66 ms 3372 KB Output is correct
21 Correct 48 ms 3272 KB Output is correct
22 Correct 49 ms 3032 KB Output is correct
23 Correct 68 ms 3444 KB Output is correct
24 Correct 67 ms 3400 KB Output is correct
25 Correct 50 ms 3272 KB Output is correct
26 Correct 51 ms 3196 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
15 Correct 64 ms 3292 KB Output is correct
16 Correct 67 ms 3272 KB Output is correct
17 Correct 60 ms 3188 KB Output is correct
18 Correct 49 ms 3084 KB Output is correct
19 Correct 66 ms 3320 KB Output is correct
20 Correct 66 ms 3372 KB Output is correct
21 Correct 48 ms 3272 KB Output is correct
22 Correct 49 ms 3032 KB Output is correct
23 Correct 68 ms 3444 KB Output is correct
24 Correct 67 ms 3400 KB Output is correct
25 Correct 50 ms 3272 KB Output is correct
26 Correct 51 ms 3196 KB Output is correct
27 Correct 69 ms 3516 KB Output is correct
28 Correct 68 ms 3448 KB Output is correct
29 Correct 52 ms 3328 KB Output is correct
30 Correct 52 ms 3256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
15 Correct 64 ms 3292 KB Output is correct
16 Correct 67 ms 3272 KB Output is correct
17 Correct 60 ms 3188 KB Output is correct
18 Correct 49 ms 3084 KB Output is correct
19 Correct 66 ms 3320 KB Output is correct
20 Correct 66 ms 3372 KB Output is correct
21 Correct 48 ms 3272 KB Output is correct
22 Correct 49 ms 3032 KB Output is correct
23 Correct 68 ms 3444 KB Output is correct
24 Correct 67 ms 3400 KB Output is correct
25 Correct 50 ms 3272 KB Output is correct
26 Correct 51 ms 3196 KB Output is correct
27 Correct 69 ms 3516 KB Output is correct
28 Correct 68 ms 3448 KB Output is correct
29 Correct 52 ms 3328 KB Output is correct
30 Correct 52 ms 3256 KB Output is correct
31 Correct 70 ms 3548 KB Output is correct
32 Correct 71 ms 3508 KB Output is correct
33 Correct 52 ms 3408 KB Output is correct
34 Correct 54 ms 3276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 7 ms 508 KB Output is correct
8 Correct 13 ms 808 KB Output is correct
9 Correct 23 ms 1412 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 17 ms 1144 KB Output is correct
12 Correct 24 ms 1444 KB Output is correct
13 Correct 19 ms 1404 KB Output is correct
14 Correct 18 ms 1316 KB Output is correct
15 Correct 64 ms 3292 KB Output is correct
16 Correct 67 ms 3272 KB Output is correct
17 Correct 60 ms 3188 KB Output is correct
18 Correct 49 ms 3084 KB Output is correct
19 Correct 66 ms 3320 KB Output is correct
20 Correct 66 ms 3372 KB Output is correct
21 Correct 48 ms 3272 KB Output is correct
22 Correct 49 ms 3032 KB Output is correct
23 Correct 68 ms 3444 KB Output is correct
24 Correct 67 ms 3400 KB Output is correct
25 Correct 50 ms 3272 KB Output is correct
26 Correct 51 ms 3196 KB Output is correct
27 Correct 69 ms 3516 KB Output is correct
28 Correct 68 ms 3448 KB Output is correct
29 Correct 52 ms 3328 KB Output is correct
30 Correct 52 ms 3256 KB Output is correct
31 Correct 70 ms 3548 KB Output is correct
32 Correct 71 ms 3508 KB Output is correct
33 Correct 52 ms 3408 KB Output is correct
34 Correct 54 ms 3276 KB Output is correct
35 Incorrect 70 ms 3588 KB Wrong Answer [2]
36 Halted 0 ms 0 KB -