제출 #784241

#제출 시각아이디문제언어결과실행 시간메모리
784241HD1Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
//we are all lost trying to be someone. #include "shoes.h" #include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0); cin.tie(0); #define sz(x) ll(x.size()) #define reve(x) reverse(x.begin(),x.end()) #define ff first #define ss second #define pb push_back using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> ii; typedef pair<ll, ii >tri; const ll MAX=1e7+100; const ll mod=1e9+7; const ll inf=1e9; vector<ll> z,s; map<ll,ll>Mp; ll cost(ll x, ll aux){ ll ans=0; for(ll i=0; i<sz(z); i++){ if(z[i]!=x)continue; ll pos=i; while(pos!=aux){ pos--; swap(z[i],z[i-1]); ans++; } break; } return ans; } ll brute(){ ll ans=0; ll pos=0; for(ll i=0; i<sz(s); i++){ ans+=cost(s[i]*-1,pos); pos++; ans+=cost(s[i],pos); pos++; } } long long count_swaps(vector<ll> c){ ll mn=1e18; for(ll i=2; i<=sz(c); i+=2){ s.push_back(i/2); } do{ z=c; mn=min(mn,brute()); }while(next_permutation(s.begin(),s.end())); return mn; }

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

shoes.cpp: In function 'll brute()':
shoes.cpp:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
/usr/bin/ld: /tmp/cc4Yl6t2.o: in function `main':
grader.cpp:(.text.startup+0x29d): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status