#include <stdio.h>
#include <stdlib.h>
long long machine1[1000000][2],machine2[1000000][2],cnt;
long long n,i,j;
void input(){
long long tmp[1000000];
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&machine1[i][0]);
tmp[machine1[i][0]]=i;
}
for(i=0;i<n;i++){
scanf("%lld",&machine2[i][0]);
machine2[i][1]=tmp[machine2[i][0]]+1;
machine1[machine2[i][1]-1][1]=i+1;
}
}
void process(){
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(machine2[i][1]>machine2[j][1]) cnt++;
}
int main(void){
input();
process();
printf("%lld",cnt);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
40024 KB |
Output is correct |
2 |
Correct |
0 ms |
40024 KB |
Output is correct |
3 |
Correct |
0 ms |
40016 KB |
Output is correct |
4 |
Correct |
0 ms |
40016 KB |
Output is correct |
5 |
Correct |
0 ms |
40020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
40024 KB |
Output is correct |
2 |
Correct |
18 ms |
40020 KB |
Output is correct |
3 |
Correct |
65 ms |
40020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
593 ms |
40016 KB |
Output is correct |
2 |
Execution timed out |
1000 ms |
40024 KB |
Program timed out |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
40016 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
40016 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |