제출 #303301

#제출 시각아이디문제언어결과실행 시간메모리
303301IWANTTOGETGOLDINIOIArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector <int> s) { int n=s.size()/2; if(n==1) { if(s[0]<s[1]) { return 0; return 1; } long long ans=0,d=0; for (int i=0;i<s.size();i++){ ans+=abs(i-d); d+=2; } return ans; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:14:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i=0;i<s.size();i++){
      |               ~^~~~~~~~~
shoes.cpp:19:1: error: expected '}' at end of input
   19 | }
      | ^
shoes.cpp:6:39: note: to match this '{'
    6 | long long count_swaps(vector <int> s) {
      |                                       ^
shoes.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^