Submission #72252

# Submission time Handle Problem Language Result Execution time Memory
72252 2018-08-26T06:23:07 Z 호우주의보(#2154, leehosu01) Box Run (FXCUP3_box) C++17
17 / 100
1000 ms 59788 KB
#pragma GCC optimize("-O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,M;
map<int,vector<int> >V;
set<int> S;
int lenn[500005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>N;
    fill (lenn,lenn+N+1,N+1);
    V[-1000000001].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 3 ms 376 KB Output is correct
2 Correct 2 ms 448 KB Output is correct
3 Correct 3 ms 448 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 2 ms 472 KB Output is correct
8 Correct 2 ms 484 KB Output is correct
9 Correct 2 ms 484 KB Output is correct
10 Correct 3 ms 484 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 448 KB Output is correct
3 Correct 3 ms 448 KB Output is correct
4 Correct 2 ms 448 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
6 Correct 2 ms 472 KB Output is correct
7 Correct 2 ms 472 KB Output is correct
8 Correct 2 ms 484 KB Output is correct
9 Correct 2 ms 484 KB Output is correct
10 Correct 3 ms 484 KB Output is correct
11 Correct 2 ms 484 KB Output is correct
12 Correct 4 ms 800 KB Output is correct
13 Correct 5 ms 1084 KB Output is correct
14 Correct 85 ms 8252 KB Output is correct
15 Correct 180 ms 13004 KB Output is correct
16 Correct 267 ms 17164 KB Output is correct
17 Correct 849 ms 43236 KB Output is correct
18 Execution timed out 1087 ms 59788 KB Time limit exceeded
19 Halted 0 ms 0 KB -