Submission #14289

#TimeUsernameProblemLanguageResultExecution timeMemory
14289tjdals1865공장 (KOI13_factory)C++98
5.60 / 20
1000 ms40024 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...