Submission #7411

#TimeUsernameProblemLanguageResultExecution timeMemory
7411gs13068공장 (KOI13_factory)C++98
20 / 20
244 ms6948 KiB
#include<cstdio> int p[1000001]; int BIT[500001]; void update(int x){while(x<=500000){BIT[x]++;x+=x&-x;}} int sum(int x){int y=0;while(x){y+=BIT[x];x-=x&-x;}return y;} int main() { long long r=0; int i,n,t; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&t); p[t]=i; } for(i=1;i<=n;i++) { scanf("%d",&t); update(p[t]); r+=i-sum(p[t]); } printf("%lld",r); }
#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...