Submission #72238

# Submission time Handle Problem Language Result Execution time Memory
72238 2018-08-26T06:17:28 Z 호우주의보(#2154, leehosu01) Box Run (FXCUP3_box) C++17
0 / 100
2 ms 356 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct A
{
    int F,S;
};
int N,M;
map<int,vector<int> >V;
set<int> S;
int lenn[500001];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>N;
    fill (lenn,lenn+N+1,N+1);
    V[-100000000].push_back(0);
    for(int i=1;i<=N;i++)
    {
        int T;
        cin>>T;
        V[-T].push_back(i);
    }
    for(auto&I:V)
    {
        for(auto&J:I.second)S.insert(J);
        for(auto&J:I.second)
        {
            auto K=S.lower_bound(J);
            if(K!=S.begin())
            {
                int&R=lenn[J-*(--K)-1];
                R=min(R,J);
            }
        }
    }
    for(int i=N-1;i;i--)lenn[i]=min(lenn[i],lenn[i+1]);
    for(int i=1;i<=N;i++)
    {
        if(lenn[i]==N+1)printf("-1 ");
        else printf("%d ",lenn[i]-i);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 356 KB Output isn't correct
3 Halted 0 ms 0 KB -