Submission #1141585

#TimeUsernameProblemLanguageResultExecution timeMemory
1141585SangCave (IOI13_cave)C++20
100 / 100
1000 ms536 KiB
#include<bits/stdc++.h>
#include "cave.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(), (a).end()
#define task "kbsiudthw"

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;

const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 2277;


void exploreCave(int N){
    int S[N] = {0}, P[N] = {0}, B[N] = {0};
    bool marked[N] = {0};
    FOR (i, 0, N - 1){
        FOR (j, 0, N-1) if (marked[j]) S[j] = P[j]; else S[j] = 0;
        int cur =0 ;
        if (tryCombination(S) == i) cur ^= 1;
        int pos = 0;
        FOR (bit, 0, 12){
            FOR (j, 0, N-1) {
                if (marked[j]) S[j] = P[j];
                else if ((j>>bit)&1) S[j] = cur;
                else S[j] = cur ^ 1;
            }
            if (tryCombination(S) != i) pos += (1<<bit);
        }
        marked[pos] = 1;
        P[pos] = cur;
        B[pos] = i;
    }
    answer(P, B);
}

#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...