Submission #1217675

#TimeUsernameProblemLanguageResultExecution timeMemory
1217675nickolasarapidisArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(int[] S){ int N = S.size()/2; map<int, vector<int>> m; long long ans = 0; for(int i = 0; i < S.size(); i++){ if(S[i] > 0 and m[-S[i]].size() > 0){ ans += i - m[-S[i]].back() + 1; m[-S[i]].pop_back(); } else if(S[i] < 0 and m[-S[i]].size() > 0){ ans += i - m[-S[i]].back(); m[-S[i]].pop_back(); } else{ m[S[i]].push_back(i); } } return ans; }

Compilation message (stderr)

shoes.cpp:5:29: error: expected ',' or '...' before 'S'
    5 | long long count_swaps(int[] S){
      |                             ^
shoes.cpp: In function 'long long int count_swaps(int*)':
shoes.cpp:6:17: error: 'S' was not declared in this scope
    6 |         int N = S.size()/2;
      |                 ^