# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1182528 | bogdiok | Baloni (COCI15_baloni) | C++20 | 290 ms | 3972 KiB |
#include <bits/stdc++.h>
using namespace std;
map<long long , long long> mp;
int a[1000001];
int main() {
long long n , nr = 0;
cin >> n;
for (int i = 1; i <= n; ++ i) {
cin >> a[i];
}
for (int i = 1; i <= n; ++ i) {
if (mp[a[i] + 1] > 0) {
-- mp[a[i] + 1];
}
++ mp[a[i]];
}
for (int i = 1; i <= 1000000 ; ++ i) {
nr += mp[a[i]];
}
cout << nr;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |