# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
98756 | M_H_H_7 | Baloni (COCI15_baloni) | C++14 | 97 ms | 15068 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//In The Name of Beauty
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 1e6 + 8;
ll const INF = 1e12 + 8;
ll const delta = 1000000007;
ll a[MAXN];
ll last[MAXN];
int main()
{
IB;
cin.tie(0);
cout.tie(0);
ll n;
cin >> n;
for(ll i = 0;i < MAXN;i++)last[i] = -1;
for(ll i = 1;i <= n;i++)cin >> a[i];
ll ans = 0;
for(ll i = n;i >= 1;i--)
{
ll t = a[i];
last[t] = i;
if(last[t - 1] == -1)ans++;
else last[t - 1] = -1;
}
cout << ans;
return 0;
}
//Written by M_H_H_7
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |