#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<int,int> mii;
const int INF = 2e5 + 100;
int n;
vi h;
mii mp;
int32_t main(){
cin >> n;
h.resize(n);
for (int i = 0; i < n; i++){
cin >> h[i];
}
int cnt = 0;
for (int i = 0; i < n; i++){
if (mp[h[i]+1] == 0) cnt++;
mp[h[i]]++;
}
cout << cnt;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
5 |
Incorrect |
182 ms |
6616 KB |
Output isn't correct |
6 |
Incorrect |
173 ms |
7444 KB |
Output isn't correct |
7 |
Incorrect |
135 ms |
6216 KB |
Output isn't correct |
8 |
Incorrect |
155 ms |
5968 KB |
Output isn't correct |
9 |
Incorrect |
161 ms |
6740 KB |
Output isn't correct |
10 |
Incorrect |
156 ms |
6640 KB |
Output isn't correct |