# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1124 |
2013-06-26T07:03:04 Z |
ainta |
공장 (KOI13_factory) |
C++ |
|
1000 ms |
0 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=2*a-a&(a-1);
}
}
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 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
6 |
Halted |
0 ms |
0 KB |
- |