Submission #44635

#TimeUsernameProblemLanguageResultExecution timeMemory
44635RayaBurong25_1Editor (BOI15_edi)C++17
15 / 100
152 ms40216 KiB
#include <stdio.h> #include <map> int Val[300005]; std::map<int, int> Last[300005]; int main() { int N; scanf("%d", &N); int i, x; std::map<int, int>::iterator it; for (i = 1; i <= N; i++) { scanf("%d", &x); if (x > 0) { Val[i] = x; Last[i][0] = i - 1; printf("%d\n", Val[i]); } else { it = Last[i - 1].upper_bound(x); Val[i] = Val[it->second]; Last[i] = Last[it->second]; Last[i][x] = i - 1; printf("%d\n", Val[i]); } } }

Compilation message (stderr)

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