Submission #1173741

#TimeUsernameProblemLanguageResultExecution timeMemory
1173741somefolkArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <cmath> #include <algorithm> #include <string> #include <vector> #include <map> #include <unordered_map> #include <queue> #include <set> #include <unordered_set> #include <complex> #include <list> #include <cassert> #include <chrono> #include <random> #include <stack> #include <iomanip> #include <fstream> using namespace std; #define endl "\n" #define int long long const int INF = 1e9+7; const int MOD = 1e9+7; int64_t count_swaps(vector<int> a){ int n = a.size(); if(n == 1){ if(a[1] < a[0]) return 1; else return 0; } vector<int> pos, neg; for(int i = 0; i < n; i++){ if(a[i] > 0 && i%2==0) pos.push_back(i); else if(a[i] < 0 && i%2!=0) neg.push_back(i); } int sol = 0, idx = 0; if(pos.size() < neg.size()){ for(auto &i : pos){ sol += abs(i-neg[idx]); idx++; } } else { for(auto &i : neg){ sol += abs(i-pos[idx]); idx++; } } return sol; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccPzPPCA.o: in function `main':
grader.cpp:(.text.startup+0x289): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status