Submission #678704

#TimeUsernameProblemLanguageResultExecution timeMemory
678704SamNguyen동굴 (IOI13_cave)C++14
12 / 100
9 ms400 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;

const int MAX = 5000 + 7;
int swit[MAX], door[MAX];

namespace Subtask1 {
    bool exploreCave(int N) {
        iota(door, door + N, 0);
        fill(swit, swit + N, 0);

        int cnt = 0;
        while (cnt <= N) {
            int i = tryCombination(swit);
            if (i == -1) {
                answer(swit, door);
                return true;
            }
            swit[i] ^= 1;
            cnt++;
        }

        return false;
    }
}

namespace Subtask2 {
    bool exploreCave(int N) {
        fill(swit, swit + N, 0);

        for (int i = 0; i < N; i++) {
            swit[i] = 1;
            door[i] = tryCombination(swit);
            swit[i] = 0;
        }
        answer(swit, door);

        return true;
    }
}

void exploreCave(int N) {
    if (Subtask1::exploreCave(N))
        return;

    Subtask2::exploreCave(N);
}
#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...