제출 #1347912

#제출 시각아이디문제언어결과실행 시간메모리
1347912stellarisqsn동굴 (IOI13_cave)C++20
100 / 100
802 ms516 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
    int S[N], S2[N], D[N];
    int K = 31 - __builtin_clz(N);
    fill(S2, S2 + N, -1);
    for (int i = 0; i < N; i++){
        int id = 0;
        bool b = 1;
        for (int j = 0; j < N; j++)
            S[j] = (S2[j] == -1 ? !b : S2[j]);
        if (tryCombination(S) != i)
            b = !b;
        for (int j = 0; j <= K; j++){
            for (int k = 0; k < N; k++)
                S[k] = (S2[k] == -1 ? ((k & (1 << j)) ? b : !b) : S2[k]);
                if (tryCombination(S) != i)
                    id |= (1 << j);
        }
        S2[id] = b;
        D[id] = i;
    }
    answer(S2, D);
}
#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...