Submission #318463

#TimeUsernameProblemLanguageResultExecution timeMemory
318463Wesley_WangArranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms492 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> s) { int n = s.size(); int p[n / 2]; for (int i = 0; i < n/2; i++) p[i] = -1; for (int i = 0; i < n; i++) { int k = abs(s[i]) - 1; if (p[k] == -1) p[k] = i; else p[k] = s[i] > 0? i - p[k] - 1: i - p[k]; } int sum = 0; for (int i = 0; i < n/2; i++) sum += p[i]; return sum; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...