Submission #217000

#TimeUsernameProblemLanguageResultExecution timeMemory
217000thatprogrammerArranging Shoes (IOI19_shoes)C++17
0 / 100
5 ms256 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; long long count_swaps(vector<int> s) { int n = s.size() / 2; ll ans = 0; for (int i = 0; i < 2 * n; i += 2) { int j; for (j = i + 1; j < 2 * n; j++) { if (s[j] == -s[i]) break; } if (s[i] < 0) ans += j - i - 1; else ans += j - i; for (; j > i; j--) swap(s[j], s[j - 1]); } cout << ans << endl; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#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...