Submission #291555

#TimeUsernameProblemLanguageResultExecution timeMemory
291555juggernautArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"shoes.h" using namespace std; typedef long long int ll; long long count_swaps(vector<int>v){ ll cnt=0,q=0,i=0,j; if(v.size()>2000){ for(;i<v.size();i++) if(v[i]<0){ cnt+=abs(i-q); q+=2; } return cnt; } for(;i<v.size();i+=2){ for(j=i;j<v.size();j++)if(a[i]==-a[j]){ q=j; break; } while(q!=i+1){ swap(v[q],v[q-1]); q--; cnt++; } if(a[i]>a[i+1])cnt++; } return cnt; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:8:15: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |         for(;i<v.size();i++)
      |              ~^~~~~~~~~
shoes.cpp:15:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(;i<v.size();i+=2){
      |          ~^~~~~~~~~
shoes.cpp:16:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(j=i;j<v.size();j++)if(a[i]==-a[j]){
      |                 ~^~~~~~~~~
shoes.cpp:16:35: error: 'a' was not declared in this scope
   16 |         for(j=i;j<v.size();j++)if(a[i]==-a[j]){
      |                                   ^
shoes.cpp:25:12: error: 'a' was not declared in this scope
   25 |         if(a[i]>a[i+1])cnt++;
      |            ^