#include<stdio.h>
#include<stdlib.h>
int jul[1000001];
int ch[1000001];
int main()
{
int n;
int i;
int cnt = 0;
scanf("%d",&n);
for(i=1;i<n;++i){
scanf("%d",&jul[i]);
}
for(i=1;i<n;++i){
ch[jul[i]]=i;
}
for(i=1;i<n;i++){
if(ch[i+1]<ch[i])
cnt++;
}
printf("%d",cnt);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
8900 KB |
Output is correct |
2 |
Incorrect |
0 ms |
8900 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
8900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
8900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
8900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
8900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
144 ms |
8900 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |