# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
607655 | jairRS | Cave (IOI13_cave) | C++17 | 101 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
const int MAXN = 5'000;
int switches[MAXN];
// door triggered by switchID
int door[MAXN];
void exploreCave(int N)
{
// doors up to curDoor EXCEPT curDoor are open
for (int curDoor = 0; curDoor < N; curDoor++)
{
int lastDoor = tryCombination(switches);
int doorOpen = lastDoor > curDoor;
int respSwitch;
for (int s = 0; s < N; s++)
{
switches[s] = !switches[s];
int doorState = tryCombination(switches) != curDoor;
switches[s] = !switches[s];
if (doorState != doorOpen)
respSwitch = s;
}
door[respSwitch] = curDoor;
if (!doorOpen)
switches[respSwitch] = !switches[respSwitch];
}
answer(switches, door);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |