Submission #670546

#TimeUsernameProblemLanguageResultExecution timeMemory
670546birthdaycakeArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
long long vs[1001]; long long count_swaps(vector<int>s) { long long n = s.size(); long long ans = 0; for(long long i = 0; i < n; i++){ long long f = 0; for(long long j = 0; j < i; j++){ if(!vs[j] && s[i] == -s[j]){ f = j + 1; break; } } if(f){ f--; vs[f] = 1; vs[f + 1] = 1; if(s[f] < 0) ans += (i - f - 1); else ans += (i - f); while(i != f + 1){ swap(s[i], s[i - 1]); i--; } if(s[f] > 0) swap(s[f], s[f + 1]); } } return ans; }

Compilation message (stderr)

shoes.cpp:2:23: error: 'vector' was not declared in this scope
    2 | long long count_swaps(vector<int>s) {
      |                       ^~~~~~
shoes.cpp:2:30: error: expected primary-expression before 'int'
    2 | long long count_swaps(vector<int>s) {
      |                              ^~~