Submission #143943

#TimeUsernameProblemLanguageResultExecution timeMemory
143943NucleistArranging Shoes (IOI19_shoes)C++14
0 / 100
2 ms256 KiB
#include <bits/stdc++.h>
#include "shoes.h" 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
ll count_swaps(vector<int>S)
{
  //flash;
  ll ans=0;
  ll index=(S.size()/2);
  for (int i = 0; i < (S.size()/2); ++i)
  {
    ans+=index;
    index--;
  }
  return ans;
}
//code the AC sol !
// BS/queue/map

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:22:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < (S.size()/2); ++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...