# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120034 | Clementime | Baloni (COCI15_baloni) | C++17 | 204 ms | 18808 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, l, r) for(ll i = l; i <= r; i++)
const ll MAX = 1000005;
ll a[MAX], dp[MAX];
bool used[MAX];
int main(){
ll n; cin >> n;
memset(used, false, sizeof used);
FOR(i, 1, n){
cin >> a[i];
}
dp[1] = 1; used[a[1]] = true;
FOR(i, 2, n){
if(used[a[i] + 1]) dp[i] = dp[i - 1];
else dp[i] = dp[i - 1] + 1;
used[a[i]] = true;
}
cout << dp[n];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |