# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72048 | 마릴린 희정 (#118) | 박스런 (FXCUP3_box) | C++17 | 4 ms | 536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int N;
int H[1010101];
int ans[1010101];
int main()
{
scanf("%d", &N);
for(int i=0; i<N; ++i) scanf("%d", H+i);
H[N] = (int)1e9+1;
int from = 0, to = 0;
multiset<int> S; S.insert(H[0]);
for(int t=0; t<N; ++t)
{
while(*S.rbegin() > H[to+1])
{
S.insert(H[++to]);
S.erase(S.find(H[from++]));
}
//printf("%d %d\n", from, to);
ans[t] = to+1;
if(from == 0)
S.insert(H[++to]);
else
S.insert(H[--from]);
}
for(int i=0; i<N; ++i)
if(ans[i] == N) printf("-1 ");
else printf("%d ", ans[i]-i);
puts("");
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |