#include<bits/stdc++.h>
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define int long long int
using namespace std;
const int MOD=1e9+7;
const int INF=4000000000000000000ll;
int mul(int a,int b)
{
if(a>INF/b) return INF;
else return a*b;
}
#undef int
int main()
{
#define int long long int
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("input.txt","r",stdin);
int n;
cin>>n;
int h[n];
FOR(i,n) cin>>h[i];
int found[1000002];
fill(found,found+1000002,0);
int ans=0;
FOR(i,n)
{
if(found[h[i]+1]==0)
{
ans++;
}
found[h[i]]=1;
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
8184 KB |
Output isn't correct |
2 |
Incorrect |
7 ms |
8296 KB |
Output isn't correct |
3 |
Incorrect |
8 ms |
8296 KB |
Output isn't correct |
4 |
Incorrect |
7 ms |
8352 KB |
Output isn't correct |
5 |
Incorrect |
134 ms |
18272 KB |
Output isn't correct |
6 |
Incorrect |
90 ms |
22564 KB |
Output isn't correct |
7 |
Incorrect |
115 ms |
24460 KB |
Output isn't correct |
8 |
Incorrect |
71 ms |
27148 KB |
Output isn't correct |
9 |
Incorrect |
80 ms |
30572 KB |
Output isn't correct |
10 |
Incorrect |
78 ms |
34040 KB |
Output isn't correct |