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 <iostream>
#include <vector>
int main(void)
{
std::cin.sync_with_stdio(false);
std::vector<int> map(1000001);
int n;
std::cin >> n;
auto result = 0;
for (auto index = 0; index < n; index++)
{
int number;
std::cin >> number;
map[number] = index;
}
for (auto index = 0; index < n; index++)
{
int number;
std::cin >> number;
result += std::abs(index - map[number]);
}
result /= 2;
std::cout << result << std::endl;
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... |