# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
599891 | starchan | Baloni (COCI15_baloni) | C++17 | 1072 ms | 59448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
set<in> cool;
signed main()
{
fast();
int n;
cin >> n;
for(int i = 1; i <= n; i++)
{
int x;
cin >> x;
cool.insert({-x, i});
}
int ans = 0;
while(cool.size())
{
ans++;
in fine = *cool.begin();
int curr = fine.f;
int index = fine.s;
cool.erase(cool.begin());
while(true)
{
if(cool.empty())
break;
auto it = cool.lower_bound({curr+1, index});
if(it == cool.end())
break;
if((*it).f == curr+1)
{
curr = (*it).f;
index = (*it).s;
cool.erase(it);
}
else
break;
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |