Submission #44637

# Submission time Handle Problem Language Result Execution time Memory
44637 2018-04-04T05:40:38 Z RayaBurong25_1 Editor (BOI15_edi) C++17
0 / 100
3000 ms 524288 KB
#include <stdio.h>
#include <map>
int Val[300005];
std::map<int, std::pair<int, int> > Last[300005];
int main()
{
    int N;
    scanf("%d", &N);
    int i, x;
    std::map<int, std::pair<int, int> >::iterator it;
    for (i = 1; i <= N; i++)
    {
        scanf("%d", &x);
        if (x > 0)
        {
            Val[i] = x;
            Last[i] = Last[i - 1];
            Last[i][i] = {0, i - 1};
            printf("%d\n", Val[i]);
        }
        else
        {
            it = Last[i - 1].end();
            it--;
            while (it->second.first <= x) it--;
            Val[i] = Val[it->second.second];
            Last[i] = Last[it->second.second];
            Last[i][i] = {x, i - 1};
            printf("%d\n", Val[i]);
        }
    }
}

Compilation message

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 time Memory Grader output
1 Correct 13 ms 14328 KB Output is correct
2 Execution timed out 3094 ms 524288 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3106 ms 524288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3070 ms 524288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 14328 KB Output is correct
2 Execution timed out 3094 ms 524288 KB Time limit exceeded
3 Halted 0 ms 0 KB -