Submission #44634

#TimeUsernameProblemLanguageResultExecution timeMemory
44634RayaBurong25_1Editor (BOI15_edi)C++17
0 / 100
203 ms37864 KiB
#include <stdio.h> #include <map> typedef struct node node; struct node { std::map<std::pair<int, int>, int> last; }; node N[300005]; int P[300005]; int main() { int n; scanf("%d", &n); int i, x; std::map<std::pair<int, int>, int>::iterator it; P[0] = 0; for (i = 1; i <= n; i++) { scanf("%d", &x); if (x > 0) { P[i] = x; N[x].last[{0, -i}] = P[i - 1]; printf("%d\n", x); } else { it = N[P[i - 1]].last.lower_bound({x + 1, -i}); P[i] = it->second; N[it->second].last[{x, -i}] = P[i - 1]; printf("%d\n", it->second); } } }

Compilation message (stderr)

edi.cpp: In function 'int main()':
edi.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
edi.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x);
         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...