Submission #915973

#TimeUsernameProblemLanguageResultExecution timeMemory
915973AiperiiiArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(),x.end() #define ff first #define ss second #define pb push_back long long count_swaps(std::vector<int> s) { int x=abs(s[0]); set <int> v; for(int i=0;i<s.size();i++){ if(s[i]==-x && i%2==1)v.insert(i); } int ans=0; for(int i=0;i<s.size();i++){ if(i%2==0 && s[i]==x){ auto it=v.upper_bound(i); ans+=(*it-i); v.erase(it); } } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<long long int>)':
shoes.cpp:12:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
shoes.cpp:16:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=0;i<s.size();i++){
      |                 ~^~~~~~~~~
/usr/bin/ld: /tmp/ccrARg89.o: in function `main':
grader.cpp:(.text.startup+0x29d): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status