Submission #1162002

#TimeUsernameProblemLanguageResultExecution timeMemory
1162002gelastropodpopa (BOI18_popa)C++20
0 / 100
15 ms436 KiB
#include "popa.h" #include <bits/stdc++.h> using namespace std; int solve(int N, int* Left, int* Right) { vector<int> p(N, -1); for (int i = 0; i < N; i++) { Left[i] = -1; Right[i] = -1; } for (int i = 1; i < N; i++) { int crnt = i - 1; int prev; bool allp = false; while (query(crnt, i, i, i)) { prev = crnt; crnt = p[crnt]; if (crnt == -1) { allp = true; break; } } if (allp) { Left[i] = prev; p[prev] = i; } else if (crnt = i - 1) { Right[i - 1] = i; p[i] = i - 1; } else { Right[crnt] = i; p[i] = crnt; Left[i] = prev; p[prev] = i; } } for (int i = 0; i < N; i++) { if (p[i] == -1) return i; } }

Compilation message (stderr)

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...