Submission #69325

# Submission time Handle Problem Language Result Execution time Memory
69325 2018-08-20T12:50:08 Z Bodo171 popa (BOI18_popa) C++14
100 / 100
111 ms 700 KB
#include "popa.h"
#include <iostream>
using namespace std;
const int nmax=1005;
int st[nmax];
int u,i;
int solve(int N, int* Left, int* Right)
{
    int root=0;
    u=0;
    for(i=0;i<N;i++)
    {
        Left[i]=Right[i]=-1;
        while(u&&query(st[u],i,i,i))
        {
            Right[st[u]]=Left[i];
            Left[i]=st[u];
            u--;
        }
        if(u) Right[st[u]]=i;
        else root=i;
        st[++u]=i;
    }
    return root;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 11 ms 384 KB Output is correct
3 Correct 12 ms 388 KB Output is correct
4 Correct 13 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 648 KB Output is correct
2 Correct 111 ms 648 KB Output is correct
3 Correct 69 ms 648 KB Output is correct
4 Correct 91 ms 700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 700 KB Output is correct
2 Correct 89 ms 700 KB Output is correct
3 Correct 43 ms 700 KB Output is correct
4 Correct 62 ms 700 KB Output is correct