Submission #296603

#TimeUsernameProblemLanguageResultExecution timeMemory
296603zoooma13Arranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "shoes.h" #include "grader.cpp" using namespace std; vector <bool> st; int qry(int l ,int r){ int ret = 0; for(int i=l; i<=r; i++) ret += !st[i]; return ret; } long long count_swaps(vector<int> s) { st.resize(s.size()); map <int ,vector<int>> mp; for(int i=(int)s.size()-1; ~i; i--) mp[s[i]].push_back(i); long long ans = 0; for(int i=0; i<s.size(); i++) if(!st[i]){ int x = s[i]; mp[x].pop_back(); int y_idx = mp[-x].back(); mp[-x].pop_back(); st[i] = 1 ,st[y_idx] = 1; ans += qry(i+1 ,y_idx-1)+(x > 0); } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0; i<s.size(); i++) if(!st[i]){
      |                  ~^~~~~~~~~
/tmp/cc8OxUTP.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccu6qDvh.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status