제출 #1171727

#제출 시각아이디문제언어결과실행 시간메모리
1171727LaMatematica14동굴 (IOI13_cave)C++20
0 / 100
126 ms764 KiB
#include "cave.h"

#include <bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
    vector<int> r(N, -1);
    int logn = 31-__builtin_clz(N);
    int bp[logn][N];

    for (int i = 0; i < logn; i++) {
        for (int j = 0; j < N; j++) {
            bp[i][j] = j&(1<<logn);
        }
    }
    int z[N];
    for (int i = 0; i < N; i++) z[i] = 0;

    int ans[N];

    for (int i = 0; i < N; i++) {
        bool d = tryCombination(z) == i;
        ans[i] = 0;
        for (int j = 0; j < logn; j++) ans[i] += (tryCombination(bp[j])==i)^d ? (1<<j) : 0;
        for (int j = 0; j < logn; j++) bp[j][ans[i]] = d;
        z[ans[i]] = d;
    }
    answer(z, ans);
}
#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...