제출 #207172

#제출 시각아이디문제언어결과실행 시간메모리
207172Sho10Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
/* ID: Sho10 LANG: C++ */ #include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long int #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define sz size #define f first #define s second #define pb push_back #define er erase #define in insert #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; vector<int>v; vector<int>l; vector<int>a; vector<int>an; vector<int>S; map<ll,ll>viz; ll count_swaps(std::vector<int> S){ v=S; if(n<=8){ for(ll i=0;i<v.size();i++) if(v[i]<0){ l.pb(v[i]); } ll ans=mod; sort(l.begin(),l.end()); do{ a=l; ll s=0; for(ll i=0;i<a.size();i++) if(a[i]<0){ a.insert(a.begin()+i+1,abs(a[i])); } an=v; for(ll i=0;i<a.size();i++) { for(ll j=i;j<an.size();j++) if(an[j]==a[i]){ for(ll c=j;c>i;c--) { swap(an[c],an[c-1]); s++; } break; } } ans=min(ans,s); }while (next_permutation(l.begin(),l.end())); }else { ll n=v.size()/2; ans=n*(n-1)/2; } return ans; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:32:8: error: 'n' was not declared in this scope
     if(n<=8){
        ^
shoes.cpp:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(ll i=0;i<v.size();i++)
                ~^~~~~~~~~
shoes.cpp:42:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(ll i=0;i<a.size();i++)
                    ~^~~~~~~~~
shoes.cpp:47:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(ll i=0;i<a.size();i++)
                    ~^~~~~~~~~
shoes.cpp:49:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(ll j=i;j<an.size();j++)
                        ~^~~~~~~~~~
shoes.cpp:63:12: error: redeclaration of 'long long int n'
         ll n=v.size()/2;
            ^
shoes.cpp:32:8: note: '<typeprefixerror>n' previously declared here
     if(n<=8){
        ^
shoes.cpp:64:9: error: 'ans' was not declared in this scope
         ans=n*(n-1)/2;
         ^~~
shoes.cpp:64:9: note: suggested alternative: 'an'
         ans=n*(n-1)/2;
         ^~~
         an
shoes.cpp:66:14: error: 'ans' was not declared in this scope
       return ans;
              ^~~
shoes.cpp:66:14: note: suggested alternative: 'an'
       return ans;
              ^~~
              an