Submission #303720

#TimeUsernameProblemLanguageResultExecution timeMemory
303720noob_c0deArranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms256 KiB
#include<bits/stdc++.h> using namespace std; #define ar array int count_swaps(vector<int> a) { vector<ar<int,2> > dg,am; for (int i=0;i<a.size();i++) { if (a[i]>0) dg.push_back({a[i],i}); else am.push_back({-a[i],i}); } sort(dg.begin(),dg.end()); sort(am.begin(),am.end()); int ans=0; for (int i=0;i<dg.size();i++) { if (dg[i][1]>am[i][1]) ans+=dg[i][1]-am[i][1]-1; else ans+=am[i][1]-dg[i][1]; } return(ans); }

Compilation message (stderr)

shoes.cpp: In function 'int count_swaps(std::vector<int>)':
shoes.cpp:7:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i=0;i<a.size();i++)
      |                  ~^~~~~~~~~
shoes.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i=0;i<dg.size();i++)
      |                  ~^~~~~~~~~~
#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...