# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1130624 | lopkus | Baloni (COCI15_baloni) | C++20 | 60 ms | 15176 KiB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6 + 1;
vector<int> cnt(N, 0);
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> a(n + 1);
int ans = n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
if(cnt[a[i] + 1]) {
cnt[a[i] + 1] -= 1;
ans -= 1;
}
cnt[a[i]] += 1;
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |