# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1183080 | bogdiok | Baloni (COCI15_baloni) | C++20 | 105 ms | 3892 KiB |
#include <bits/stdc++.h>
using namespace std;
int a[1000001],freq[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 (freq[a[i] + 1] > 0) {
-- freq[a[i] + 1];
++ freq[a[i]];
} else {
++nr;
++ freq[a[i]];
}
}
cout << nr;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |