#include <iostream>
#include <algorithm>
using namespace std;
int n,v[100010],f[100010],sum,of;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>v[i];
}
for(int i=1;i<=n;i++){
if(f[v[i]]==0)
of++;
else
f[v[i]]--;
f[v[i]-1]++;
}
cout<<of;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Incorrect |
44 ms |
1400 KB |
Output isn't correct |
6 |
Incorrect |
40 ms |
1272 KB |
Output isn't correct |
7 |
Incorrect |
46 ms |
1400 KB |
Output isn't correct |
8 |
Incorrect |
40 ms |
1272 KB |
Output isn't correct |
9 |
Incorrect |
42 ms |
1272 KB |
Output isn't correct |
10 |
Incorrect |
40 ms |
1272 KB |
Output isn't correct |