Submission #987341

# Submission time Handle Problem Language Result Execution time Memory
987341 2024-05-22T15:23:07 Z lucri Editor (BOI15_edi) C++17
35 / 100
3000 ms 10836 KB
#include <bits/stdc++.h>
using namespace std;
long long n,v[300010],ans[300010],ant[300010];
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>v[i];
        if(v[i]>0)
        {
            ans[i]=v[i];
            ant[i]=i-1;
            continue;
        }
        int poz=i-1;
        while(v[poz]<=v[i])
        {
            poz=ant[poz];
        }
        ant[i]=poz-1;
        ans[i]=ans[ant[i]];
    }
    for(int i=1;i<=n;++i)
        cout<<ans[i]<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 4 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 7 ms 4444 KB Output is correct
6 Correct 2 ms 4440 KB Output is correct
7 Correct 2 ms 4696 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 10836 KB Output is correct
2 Correct 75 ms 10832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 8540 KB Output is correct
2 Correct 49 ms 8784 KB Output is correct
3 Execution timed out 3026 ms 8004 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 4 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 7 ms 4444 KB Output is correct
6 Correct 2 ms 4440 KB Output is correct
7 Correct 2 ms 4696 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 4444 KB Output is correct
10 Correct 74 ms 10836 KB Output is correct
11 Correct 75 ms 10832 KB Output is correct
12 Correct 42 ms 8540 KB Output is correct
13 Correct 49 ms 8784 KB Output is correct
14 Execution timed out 3026 ms 8004 KB Time limit exceeded
15 Halted 0 ms 0 KB -