답안 #521299

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521299 2022-02-01T14:26:16 Z qwerasdfzxcl Park (JOI17_park) C++14
10 / 100
454 ms 620 KB
#include "park.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
mt19937 seed(123456);
uniform_int_distribution<int> rng(0, 2147483647);

static int Place[1400];

int getrand(int l, int r){
    return rng(seed)%(r-l+1) + l;
}

void dnc(vector<int> A){
    //for (auto &x:A) printf(" %d", x);
    //printf("\n");
    if (A.size()<=1) return;
    memset(Place, 0, sizeof(Place));
    for (auto &x:A) Place[x] = 1;

    int idx = getrand(1, (int)A.size()-1);
    //printf("idx: %d\n", A[idx]);

    vector<int> nA = {A[0]}, nB = {A[idx]};
    Place[A[idx]] = 0;
    for (int i=1;i<(int)A.size();i++) if (i!=idx){
        if (Ask(min(A[0], A[i]), max(A[0], A[i]), Place)) nA.push_back(A[i]);
        else nB.push_back(A[i]);
    }
    //printf("YES\n");

    for (auto &x:A) Place[x] = 0;
    Place[A[idx]] = 1;
    for (auto &x:nA){
        //printf("x = %d\n", x);
        Place[x] = 1;
        if (Ask(min(x, A[idx]), max(x, A[idx]), Place)){
            if (A[idx] < x) Answer(A[idx], x);
            else Answer(x, A[idx]);
        }
        Place[x] = 0;
    }

    dnc(nA);
    dnc(nB);

}

void Detect(int T, int N) {
    vector<int> V;
    for (int i=0;i<N;i++) V.push_back(i);
    dnc(V);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 22 ms 428 KB Output is correct
3 Correct 20 ms 384 KB Output is correct
4 Incorrect 54 ms 472 KB Wrong Answer[5]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 460 KB Output is correct
2 Correct 31 ms 460 KB Output is correct
3 Correct 31 ms 368 KB Output is correct
4 Correct 60 ms 460 KB Output is correct
5 Correct 50 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 364 ms 572 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 219 ms 544 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 454 ms 620 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -