Submission #607652

#TimeUsernameProblemLanguageResultExecution timeMemory
607652jairRSCave (IOI13_cave)C++17
0 / 100
26 ms388 KiB
#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 = lastDoor > curDoor; switches[s] = !switches[s]; if (doorState != doorOpen) respSwitch = s; } door[respSwitch] = curDoor; if (!doorOpen) switches[curDoor] = !switches[curDoor]; } answer(switches, door); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:26: warning: 'respSwitch' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         door[respSwitch] = curDoor;
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~
#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...