# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
230993 | kai824 | Baloni (COCI15_baloni) | C++17 | 1283 ms | 93944 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"bits/stdc++.h"
using namespace std;
int h[1000005];
set<int> cnt[1000005];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n,cur,ans=0;
cin>>n;
for(int x=0;x<n;x++){
cin>>h[x];
cnt[h[x]].insert(x);
}
for(int x=0;x<n;x++){
if(h[x]==0)continue;
ans++;
cur=x;
for(int u=h[x]-1;u>0;u--){
if(cnt[u].lower_bound(cur)==cnt[u].end()){
break;
}
cur= *cnt[u].lower_bound(cur);
h[cur]=0;
cnt[u].erase(cur);
}
cnt[h[x]].erase(x);
h[x]=0;
}
cout<<ans<<'\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |