제출 #631757

#제출 시각아이디문제언어결과실행 시간메모리
631757StavabArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
using namespace std; long long count_swaps(vector<int> S) { long long sum = 0; int temp; for(int i = 0; i < S.size() - 1; i += 2) { temp = 0; for(int j = i + 1; j < S.size(); j++) { if(temp) swap(temp, S[j]); else temp = S[j]; if(temp == -S[i]) { if(temp < 0) sum += j - i; else sum += j - i - 1; break; } } } return sum; }

컴파일 시 표준 에러 (stderr) 메시지

shoes.cpp:3:23: error: 'vector' was not declared in this scope
    3 | long long count_swaps(vector<int> S)
      |                       ^~~~~~
shoes.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | using namespace std;
shoes.cpp:3:30: error: expected primary-expression before 'int'
    3 | long long count_swaps(vector<int> S)
      |                              ^~~