Submission #278396

#TimeUsernameProblemLanguageResultExecution timeMemory
278396ctziapoArranging Shoes (IOI19_shoes)C++14
50 / 100
1091 ms2936 KiB
#include "shoes.h" long long count_swaps(std::vector<int> s) { int ans=0; /// n^2 int v[s.size()]={}; for(int i=0;i<s.size();i++){ if(v[i]==1) continue; int cou=0; if(s[i]>0) cou=1; int f=-s[i]; for(int j=i+1;j<s.size();j++){ if(s[j]==f && v[j]!=1){ v[j]=1; v[i]=1; // cout<<cou<<" "<<i<<" "<<j<<endl; break; } if(v[j]==0){ cou++; } } ans+=cou; } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:9:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(int i=0;i<s.size();i++){
      |              ~^~~~~~~~~
shoes.cpp:16:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int j=i+1;j<s.size();j++){
      |                       ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...