Submission #318787

#TimeUsernameProblemLanguageResultExecution timeMemory
318787Wesley_WangCave (IOI13_cave)C++14
0 / 100
27 ms492 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int determine[5000]; int correspond[5000]; int ord[5000]; void DoSort (int left, int right) { if (left == right) { correspond[left] = ord[left]; return; } int pivot = tryCombination(determine); int pivot_point; int r = right; for (int i = left; i <= right; i++) { int o = correspond[i]; determine[correspond[o]] = !determine[correspond[o]]; int t = tryCombination(determine); if (t != pivot) { correspond[i] = t; if (t > pivot) pivot_point = i; } else correspond[i] = r--; determine[correspond[o]] = !determine[correspond[o]]; } determine[correspond[pivot_point]] = !determine[correspond[pivot_point]]; DoSort(pivot + 1, right); } void exploreCave(int N) { for (int i = 0; i < N; i++) determine[i] = rand() % 2; for (int i = 0; i < N; i++) correspond[i] = i; DoSort(0, N); answer(determine, correspond); }

Compilation message (stderr)

cave.cpp: In function 'void DoSort(int, int)':
cave.cpp:39:75: warning: 'pivot_point' may be used uninitialized in this function [-Wmaybe-uninitialized]
   39 |     determine[correspond[pivot_point]] = !determine[correspond[pivot_point]];
      |                                                     ~~~~~~~~~~~~~~~~~~~~~~^
#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...