Submission #623233

#TimeUsernameProblemLanguageResultExecution timeMemory
623233PanTkdArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
// // main.cpp // // Created by Panagiotis Chadjicostas on // Copyright © Panagiotis Hadjicostas. All rights reserved. // #include <iostream> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <fstream> #include <iomanip> #include <iterator> #include <limits> #include <list> #include <cstring> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #include <unordered_map> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> ii; #define fo(i,a,b) for(int i = a; i<=b; i++) #define f(i,b) for(int i=0;i<b;i++) #define F first #define S second #define sz size #define ls s,m,idx<<1 #define rs m+1,e,idx<<1|1 const ll MOD=ll(1e9)+7; const ll MAXN=2*ll(1e6); void checker(){ ll n=rand()%20+2; vi a(n,ll()); for(ll i=0;i<n;i++){ a[i]=rand()%20+2; } for(ll b=0;b<(1<<n);b++){ vi on,off; for(ll i=0;i<n;i++){ if(i&(1<<i)){ on.push_back(i); } else{ off.push_back(i); } } } } /////////////////////////////////////////////////////////////////////// struct shoes{ int s; bool r; }; long long count_swaps(vector <int> S) { ll n=S.size(); shoes A[n]; ll m=n/2; for(ll i=0;i<n;i++){ A[i].s=abs(S[i]); A[i].r=(S[i]>0); } vi V(n,0); ll ans=0; for(ll i=0;i<n;i++){ if(V[i])continue; for(ll j=i+1;j<n;j++){ if(A[i].s==A[j].s&&!V[j]&&A[i].r!=A[j].r){ V[j]=1; if(A[i].r) ans++; break; }else ans+=(V[j]^1); } } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int myArray[] = { -1,-1,1,-1,1,1 }; vector<int> v(begin(myArray), end(myArray)); cout<<count_swaps(v); return 0; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:68:8: warning: unused variable 'm' [-Wunused-variable]
   68 |     ll m=n/2;
      |        ^
/usr/bin/ld: /tmp/cc2AoiMF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1qQfBF.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status