# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
710567 |
2023-03-15T11:10:56 Z |
ToroTN |
Baloni (COCI15_baloni) |
C++14 |
|
196 ms |
7328 KB |
#include<bits/stdc++.h>
using namespace std;
int n,a[1000005],hsh[1000005],cnt=0;
int main()
{
cin >> n;
for(int i=1;i<=n;i++)cin >> a[i];
for(int i=n;i>=1;i--)
{
if(hsh[a[i]-1]==0)
{
++cnt;
}else
{
--hsh[a[i]-1];
}
++hsh[a[i]];
}
printf("%d\n",cnt);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
304 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 |
196 ms |
6992 KB |
Output is correct |
6 |
Correct |
183 ms |
7328 KB |
Output is correct |
7 |
Correct |
167 ms |
5952 KB |
Output is correct |
8 |
Correct |
139 ms |
5852 KB |
Output is correct |
9 |
Correct |
161 ms |
6420 KB |
Output is correct |
10 |
Correct |
174 ms |
6512 KB |
Output is correct |