Submission #146763

#TimeUsernameProblemLanguageResultExecution timeMemory
146763youssan_williamArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool v[1000000000]; int main() { ll n; cin>>n; ll arr[2*n+1]; ll a[n+1],b[n+1]; for(int i = 1 ; i <= 2*n ; i++) { cin >> arr[i]; } ll ans=0; for(int i = 1 ; i <=2*n ; i++) { if(!v[abs(arr[i])]) { v[abs(arr[i])]=1; for(int j =i+1 ; j <= 2 * n ;j++) { if(abs(arr[i])==abs(arr[j])) { for(int k=j-1 ; k>i ;k--) { swap(arr[k],arr[k+1]); ans++; } break; } } } } for(int i = 1 ; i <=2*n ;i++ ) { if(i%2==1&&arr[i]>arr[i+1]) ans++; } cout << ans; return 0; }

Compilation message (stderr)

shoes.cpp: In function 'int main()':
shoes.cpp:10:8: warning: unused variable 'a' [-Wunused-variable]
     ll a[n+1],b[n+1];
        ^
shoes.cpp:10:15: warning: unused variable 'b' [-Wunused-variable]
     ll a[n+1],b[n+1];
               ^
/tmp/ccI2WcTz.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccUdDiqS.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/ccI2WcTz.o: In function `main':
grader.cpp:(.text.startup+0x272): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status