제출 #104672

#제출 시각아이디문제언어결과실행 시간메모리
104672Badral동굴 (IOI13_cave)C++17
0 / 100
451 ms516 KiB
#include <bits/stdc++.h>
#include "cave.h"

using namespace std;

int hsn[5123];
int por[5123];
int ans[5123];
int mdk[5123];

bool can(int k, int o) {
    for(int i = 1; i <= k; i++) 
        if(ans[i] == -1) 
            hsn[i] = ans[o];
        else hsn[i] = ans[i];
    int p = tryCombination(hsn);
    return p > o;
}

void exploreCave(int N) {
    memset(ans, -1, sizeof ans);

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) 
            hsn[j] = max(0, ans[j]);
        int p = tryCombination(hsn);
        if(p > i || p == -1) 
            ans[i] = 0;
        else ans[i] = 1;
        int kk = 0;
        for(int i = N-1; i >= 1; i /= 2) 
            while(i + kk <= N && can(i+kk, i)) 
                kk += i;
        mdk[kk] = i;
    }
    answer(ans, mdk);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...