Submission #287716

#TimeUsernameProblemLanguageResultExecution timeMemory
287716luciocfpopa (BOI18_popa)C++14
100 / 100
101 ms500 KiB
#include <bits/stdc++.h> #include "popa.h" using namespace std; int solve(int n, int *l, int *r) { stack<int> stk; for (int i = 0; i < n; i++) { l[i] = r[i] = -1; while (stk.size() && query(stk.top(), i, i, i)) { l[i] = stk.top(); stk.pop(); } if (stk.size()) r[stk.top()] = i; stk.push(i); } int root; while (stk.size()) { root = stk.top(); stk.pop(); } return root; }

Compilation message (stderr)

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:33:10: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |   return root;
      |          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...