# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1116 |
2013-06-25T19:50:28 Z |
ainta |
공장 (KOI13_factory) |
C++ |
|
263 ms |
8696 KB |
#include<stdio.h>
int N,ord[1000001],BIT[500010],i,w[500010];
long long Res;
int Sum(int a){
int s=0;
while(a){
s+=BIT[a];
a=a&(a-1);
}
return s;
}
void add(int a){
while(a<=N){
BIT[a]++;
a+=a&-a;
}
}
int main()
{
int a;
scanf("%d",&N);
for(i=1;i<=N;i++){
scanf("%d",&a);
ord[a]=i;
}
for(i=1;i<=N;i++){
scanf("%d",&a);
w[ord[a]]=i;
}
for(i=1;i<=N;i++){
add(w[i]);
Res=Res+w[i]-Sum(w[i]);
}
printf("%lld\n",Res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
8696 KB |
Output is correct |
2 |
Correct |
0 ms |
8696 KB |
Output is correct |
3 |
Correct |
0 ms |
8696 KB |
Output is correct |
4 |
Correct |
0 ms |
8696 KB |
Output is correct |
5 |
Correct |
0 ms |
8696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8696 KB |
Output is correct |
2 |
Correct |
0 ms |
8696 KB |
Output is correct |
3 |
Correct |
3 ms |
8696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
8696 KB |
Output is correct |
2 |
Correct |
24 ms |
8696 KB |
Output is correct |
3 |
Correct |
33 ms |
8696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
8696 KB |
Output is correct |
2 |
Correct |
77 ms |
8696 KB |
Output is correct |
3 |
Correct |
95 ms |
8696 KB |
Output is correct |
4 |
Correct |
154 ms |
8696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
203 ms |
8696 KB |
Output is correct |
2 |
Correct |
217 ms |
8696 KB |
Output is correct |
3 |
Correct |
226 ms |
8696 KB |
Output is correct |
4 |
Correct |
258 ms |
8696 KB |
Output is correct |
5 |
Correct |
263 ms |
8696 KB |
Output is correct |
6 |
Correct |
260 ms |
8696 KB |
Output is correct |