#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
#define int long long
const int maxn = 1e6 + 69;
vector<int> cnt(maxn);
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while(tt--) {
int n;
cin >> n;
vector<int> a(n);
for(int i = 0;i < n;i++)
cin >> a[i];
int ans = 1;
cnt[a[0]] = 1;
for(int i = 1;i < n;i++) {
if(!cnt[a[i] + 1])
++ans;
cnt[a[i]] = 1;
}
cout << ans;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
8148 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
8164 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
8180 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
8148 KB |
Output isn't correct |
5 |
Incorrect |
46 ms |
17920 KB |
Output isn't correct |
6 |
Incorrect |
47 ms |
18524 KB |
Output isn't correct |
7 |
Incorrect |
44 ms |
16676 KB |
Output isn't correct |
8 |
Incorrect |
40 ms |
16492 KB |
Output isn't correct |
9 |
Incorrect |
43 ms |
17308 KB |
Output isn't correct |
10 |
Incorrect |
43 ms |
17408 KB |
Output isn't correct |