Submission #287709

#TimeUsernameProblemLanguageResultExecution timeMemory
287709luciocfpopa (BOI18_popa)C++14
0 / 100
18 ms372 KiB
#include <bits/stdc++.h> #include "popa.h" using namespace std; int solve(int N, int *l, int *r) { memset(l, -1, sizeof l); memset(r, -1, sizeof r); int n = N; stack<int> stk; for (int i = 0; i < n; i++) { 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:8:16: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    8 |  memset(l, -1, sizeof l); memset(r, -1, sizeof r);
      |                ^~~~~~~~
popa.cpp:8:41: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    8 |  memset(l, -1, sizeof l); memset(r, -1, sizeof r);
      |                                         ^~~~~~~~
popa.cpp:35:10: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |   return root;
      |          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...