# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
568687 |
2022-05-26T05:12:25 Z |
Garguy22 |
Baloni (COCI15_baloni) |
C++17 |
|
193 ms |
3748 KB |
#include <iostream>
using namespace std;
const int MAXN = 1e6 + 7;
int a[MAXN], f[MAXN];
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; i++)
cin >> a[i];
int ans = 0;
for(int i = n; i > 0; i--){
f[a[i]]++;
if(f[a[i]-1])
f[a[i]-1]--;
else
ans++;
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
182 ms |
3424 KB |
Output is correct |
6 |
Correct |
173 ms |
3748 KB |
Output is correct |
7 |
Correct |
193 ms |
3120 KB |
Output is correct |
8 |
Correct |
152 ms |
3192 KB |
Output is correct |
9 |
Correct |
178 ms |
3272 KB |
Output is correct |
10 |
Correct |
174 ms |
3332 KB |
Output is correct |