This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |