# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
607659 | jairRS | Cave (IOI13_cave) | C++17 | 108 ms | 360 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 queryLastDoor = tryCombination(switches);
if (queryLastDoor == -1)
queryLastDoor = N;
switches[s] = !switches[s];
if (doorOpen)
{
if (queryLastDoor == curDoor)
respSwitch = s;
}
else if (queryLastDoor > curDoor)
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... |