Submission #974770

#TimeUsernameProblemLanguageResultExecution timeMemory
974770HasanV11010238Cave (IOI13_cave)C++17
46 / 100
16 ms568 KiB
#include "cave.h" int f(int N, int ar[], int cl[]){ int anscl[N]; for (int i = 0; i < N; i++){ anscl[i] = 1 - cl[i]; if (ar[i] == -1){ cl[i] = 1 - cl[i]; ar[i] = tryCombination(cl); cl[i] = 1 - cl[i]; } } answer(cl, ar); } void exploreCave(int N) { int ar[N], cl[N]; for (int i = 0; i < N; i++){ cl[i] = 0; ar[i] = -1; } int def = 0, bes = tryCombination(cl); for (int in = 0; bes != -1; in++){ int i = in % N; if (ar[i] == -1){ cl[i] = 1 - cl[i]; int tr = tryCombination(cl); if (tr > bes || tr == -1){ ar[i] = bes; bes = tr; } else if (tr == bes){ cl[i] = 1 - cl[i]; } else{ ar[i] = tr; cl[i] = 1 - cl[i]; } } } f(N, ar, cl); }

Compilation message (stderr)

cave.cpp: In function 'int f(int, int*, int*)':
cave.cpp:3:9: warning: variable 'anscl' set but not used [-Wunused-but-set-variable]
    3 |     int anscl[N];
      |         ^~~~~
cave.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | }
      | ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:20:9: warning: unused variable 'def' [-Wunused-variable]
   20 |     int def = 0, bes = tryCombination(cl);
      |         ^~~
#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...