# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
268536 | mayhoubsaleh | Baloni (COCI15_baloni) | C++14 | 1514 ms | 100412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const ll maxn=1e6+100;
const ll inf=1e9+10;
ll n;
ll h[maxn];
int ans;
bool don[maxn];
set<int>pos[maxn];
void arr(int cur,int id){
if(!cur)return;
auto it=pos[cur].lower_bound(id);
if(it==pos[cur].end())return;
int x=*it;
don[x]=1;
pos[cur].erase(it);
arr(cur-1,x);
}
int main()
{
IOS
cin>>n;
for(int i=0;i<n;i++){
cin>>h[i];
pos[h[i]].insert(i);
}
for(int i=0;i<n;i++){
if(don[i])continue;
arr(h[i],i);
ans++;
}
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |