Submission #211063

#TimeUsernameProblemLanguageResultExecution timeMemory
211063lyhArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> S) { // long long count_swaps() { long long sum= 0; for(int i= 0; i < 2 * n; i+= 2) { int k; for(k= i; k < 2 * n; k++) { if(S[k] > 0) break; } for(int j= k; j > i; j--) { swap(S[j], S[j - 1]); sum++; } for(k= i + 1; k < 2 * n; k++) { if(S[k] == -S[i]) { break; } } for(int j= k; j > i + 1; j--) { swap(S[j], S[j - 1]); sum++; } } return sum; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:8:24: error: 'n' was not declared in this scope
  for(int i= 0; i < 2 * n; i+= 2) {
                        ^