Submission #44639

#TimeUsernameProblemLanguageResultExecution timeMemory
44639RayaBurong25_1Editor (BOI15_edi)C++17
35 / 100
3043 ms7340 KiB
#include <stdio.h> #include <vector> int Val[300005]; typedef struct node node; struct node { int level; int last; int next; }; node Last[300005]; // std::vector<std::pair<int, int> > Last[300005]; int main() { int N; scanf("%d", &N); int i, x; // std::vector<std::pair<int, int> >::iterator it; int j; for (i = 1; i <= N; i++) { scanf("%d", &x); if (x > 0) { Val[i] = x; // Last[i] = Last[i - 1]; // Last[i].push_back({0, i - 1}); Last[i] = {0, i - 1, i - 1}; printf("%d\n", Val[i]); } else { // it = Last[i - 1].end(); // it--; // while (it->first <= x) it--; j = i - 1; while (Last[j].level <= x) j = Last[j].next; j = Last[j].last; Val[i] = Val[j]; // Last[i] = Last[it->second]; // Last[i].push_back({x, i - 1}); Last[i] = {x, i - 1, j}; printf("%d\n", Val[i]); } } }

Compilation message (stderr)

edi.cpp: In function 'int main()':
edi.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
edi.cpp:22: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...