# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44635 | RayaBurong25_1 | Editor (BOI15_edi) | C++17 | 152 ms | 40216 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |