#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(nullptr);
#define ll long long
#define pb push_back
#define all(a) a.begin(),a.end()
void solve()
{
int n;cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int cnt=0;
for(int i=0;i<n;i++){
if(a[i]-a[i+1]==1){
continue;
}
else{
cnt++;
}
}
cout<<cnt+1<<endl;
}
int main()
{
fast
int tc=1;
//cin>>tc;
while(tc--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
50 ms |
6912 KB |
Output isn't correct |
6 |
Incorrect |
59 ms |
7160 KB |
Output isn't correct |
7 |
Incorrect |
44 ms |
5916 KB |
Output isn't correct |
8 |
Incorrect |
45 ms |
5884 KB |
Output isn't correct |
9 |
Incorrect |
47 ms |
6348 KB |
Output isn't correct |
10 |
Incorrect |
48 ms |
6408 KB |
Output isn't correct |