제출 #151205

#제출 시각아이디문제언어결과실행 시간메모리
151205outsiderArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> #define ll int #define x first #define y second using namespace std; ll count_swaps(vector<ll> a){ ll ans=0; ll n=a.size()/2; a.push_front(0); for (int i=0;i<a.size();i++) { ll mt=0; for (ll k=i+1;k<a.size();k++) { if (a[k]==-a[i]) { ans+=mt; if (a[i]>0)ans++; a[k]=0; break; } else if (a[k]!=0)mt++; } } return ans; }

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

shoes.cpp: In function 'int count_swaps(std::vector<int>)':
shoes.cpp:7:4: error: ambiguating new declaration of 'int count_swaps(std::vector<int>)'
 ll count_swaps(vector<ll> a){
    ^~~~~~~~~~~
In file included from shoes.cpp:1:0:
shoes.h:7:11: note: old declaration 'long long int count_swaps(std::vector<int>)'
 long long count_swaps(std::vector<int> S);
           ^~~~~~~~~~~
shoes.cpp:10:3: error: 'class std::vector<int>' has no member named 'push_front'; did you mean 'push_back'?
 a.push_front(0);
   ^~~~~~~~~~
   push_back
shoes.cpp:11:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for (int i=0;i<a.size();i++)
              ~^~~~~~~~~
shoes.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ll k=i+1;k<a.size();k++)
                   ~^~~~~~~~~
shoes.cpp:9:4: warning: unused variable 'n' [-Wunused-variable]
 ll n=a.size()/2;
    ^