답안 #258676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
258676 2020-08-06T10:59:21 Z Kastanda Minerals (JOI19_minerals) C++14
85 / 100
55 ms 3572 KB
// M
#include<bits/stdc++.h>
#include "minerals.h"
using namespace std;
const int N = 47007 * 2;
int last = 0, M[N];
int Do(int i)
{
        M[i] ^= 1;
        int c = Query(i);
        int w = last != c;
        last = c;
        return w;
}
void Recur(vector < int > &A, vector < int > &B, int w = 3)
{
        assert(A.size() == B.size());
        if ((int)A.size() == 1)
        {
                Answer(A[0], B[0]);
                return ;
        }
        int m = (int)A.size();
        int md = max((int)(m * 0.67), 1);
        md = min(md, m - 1);
        vector < int > A1, A2, B1, B2;
        for (int i = 0; i < m; i ++)
        {
                if (i < md)
                        A1.push_back(A[i]);
                else
                        A2.push_back(A[i]);
        }
        if (w == 3)
        {
                for (int i : A2)
                        assert(!Do(i));
                for (int i : B)
                {
                        if (Do(i))
                                B2.push_back(i);
                        else
                                B1.push_back(i);
                }
                Recur(A1, B1, 1);
                Recur(A2, B2, 0);
                return ;
        }
        if (w == 2)
                return void(Recur(B, A, 1));
        if (w == 1)
        {
                for (int i : A2)
                        assert(Do(i));
                for (int i : B)
                {
                        if (Do(i))
                                B2.push_back(i);
                        else
                                B1.push_back(i);
                }
                Recur(A1, B1, 3);
                Recur(A2, B2, 2);
                return ;
        }
        if (w == 0)
        {
                for (int i : A2)
                        assert(Do(i));
                for (int i : B)
                {
                        if (Do(i))
                                B1.push_back(i);
                        else
                                B2.push_back(i);
                }
                Recur(A2, B2, 3);
                Recur(A1, B1, 2);
                return ;
        }
        assert(0);
}
void Solve(int n)
{
        vector < int > A, B;
        for (int i = 1; i <= n + n; i ++)
        {
                if (Do(i))
                        A.push_back(i);
                else
                        B.push_back(i);
        }
        Recur(A, B, 3);
        return ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 5 ms 640 KB Output is correct
4 Correct 9 ms 896 KB Output is correct
5 Correct 18 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
15 Correct 49 ms 3220 KB Output is correct
16 Correct 49 ms 3256 KB Output is correct
17 Correct 44 ms 3060 KB Output is correct
18 Correct 47 ms 2872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
15 Correct 49 ms 3220 KB Output is correct
16 Correct 49 ms 3256 KB Output is correct
17 Correct 44 ms 3060 KB Output is correct
18 Correct 47 ms 2872 KB Output is correct
19 Correct 51 ms 3316 KB Output is correct
20 Correct 52 ms 3316 KB Output is correct
21 Correct 43 ms 3104 KB Output is correct
22 Correct 43 ms 2932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
15 Correct 49 ms 3220 KB Output is correct
16 Correct 49 ms 3256 KB Output is correct
17 Correct 44 ms 3060 KB Output is correct
18 Correct 47 ms 2872 KB Output is correct
19 Correct 51 ms 3316 KB Output is correct
20 Correct 52 ms 3316 KB Output is correct
21 Correct 43 ms 3104 KB Output is correct
22 Correct 43 ms 2932 KB Output is correct
23 Correct 54 ms 3316 KB Output is correct
24 Correct 52 ms 3316 KB Output is correct
25 Correct 45 ms 3104 KB Output is correct
26 Correct 45 ms 2976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
15 Correct 49 ms 3220 KB Output is correct
16 Correct 49 ms 3256 KB Output is correct
17 Correct 44 ms 3060 KB Output is correct
18 Correct 47 ms 2872 KB Output is correct
19 Correct 51 ms 3316 KB Output is correct
20 Correct 52 ms 3316 KB Output is correct
21 Correct 43 ms 3104 KB Output is correct
22 Correct 43 ms 2932 KB Output is correct
23 Correct 54 ms 3316 KB Output is correct
24 Correct 52 ms 3316 KB Output is correct
25 Correct 45 ms 3104 KB Output is correct
26 Correct 45 ms 2976 KB Output is correct
27 Correct 53 ms 3444 KB Output is correct
28 Correct 55 ms 3444 KB Output is correct
29 Correct 46 ms 3188 KB Output is correct
30 Correct 46 ms 3060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
15 Correct 49 ms 3220 KB Output is correct
16 Correct 49 ms 3256 KB Output is correct
17 Correct 44 ms 3060 KB Output is correct
18 Correct 47 ms 2872 KB Output is correct
19 Correct 51 ms 3316 KB Output is correct
20 Correct 52 ms 3316 KB Output is correct
21 Correct 43 ms 3104 KB Output is correct
22 Correct 43 ms 2932 KB Output is correct
23 Correct 54 ms 3316 KB Output is correct
24 Correct 52 ms 3316 KB Output is correct
25 Correct 45 ms 3104 KB Output is correct
26 Correct 45 ms 2976 KB Output is correct
27 Correct 53 ms 3444 KB Output is correct
28 Correct 55 ms 3444 KB Output is correct
29 Correct 46 ms 3188 KB Output is correct
30 Correct 46 ms 3060 KB Output is correct
31 Incorrect 55 ms 3572 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 5 ms 640 KB Output is correct
8 Correct 9 ms 896 KB Output is correct
9 Correct 18 ms 1408 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 12 ms 1152 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 16 ms 1464 KB Output is correct
14 Correct 17 ms 1456 KB Output is correct
15 Correct 49 ms 3220 KB Output is correct
16 Correct 49 ms 3256 KB Output is correct
17 Correct 44 ms 3060 KB Output is correct
18 Correct 47 ms 2872 KB Output is correct
19 Correct 51 ms 3316 KB Output is correct
20 Correct 52 ms 3316 KB Output is correct
21 Correct 43 ms 3104 KB Output is correct
22 Correct 43 ms 2932 KB Output is correct
23 Correct 54 ms 3316 KB Output is correct
24 Correct 52 ms 3316 KB Output is correct
25 Correct 45 ms 3104 KB Output is correct
26 Correct 45 ms 2976 KB Output is correct
27 Correct 53 ms 3444 KB Output is correct
28 Correct 55 ms 3444 KB Output is correct
29 Correct 46 ms 3188 KB Output is correct
30 Correct 46 ms 3060 KB Output is correct
31 Incorrect 55 ms 3572 KB Wrong Answer [2]
32 Halted 0 ms 0 KB -