#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=1e6+5;
int a[N],n;
bool b[N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for (int i=1;i<=n;i++) cin>>a[i];
int ans=n;
for (int i=n;i;i--){
ans-=b[a[i]-1];
b[a[i]]=1;
}cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
35 ms |
6492 KB |
Output isn't correct |
6 |
Incorrect |
35 ms |
7260 KB |
Output isn't correct |
7 |
Incorrect |
27 ms |
6172 KB |
Output isn't correct |
8 |
Incorrect |
27 ms |
6088 KB |
Output isn't correct |
9 |
Incorrect |
34 ms |
6224 KB |
Output isn't correct |
10 |
Incorrect |
29 ms |
6492 KB |
Output isn't correct |