Submission #427026

#TimeUsernameProblemLanguageResultExecution timeMemory
427026Ahmadsm2005Arranging Shoes (IOI19_shoes)C++14
10 / 100
1086 ms3752 KiB
#include "shoes.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; vector<int>POS; long long count_swaps(vector<int>s){ for(int i=0;i<s.size();i++){ if(s[i]<0) POS.push_back(s[i]); } long long ANS=0; for(int i=0;i<POS.size();i++){ for(int l=i*2;l<s.size();l++){ if(s[l]==POS[i]){ for(int x=l-1;x>=i*2;x--){ swap(s[x],s[x+1]),ANS++; } break; } } for(int l=i*2+1;l<s.size();l++){ if(s[l]==-POS[i]){ for(int x=l-1;x>=i*2+1;x--) swap(s[x],s[x+1]),ANS++; break; } } } return ANS; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:7:14: 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<s.size();i++){
      |             ~^~~~~~~~~
shoes.cpp:12:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 | for(int i=0;i<POS.size();i++){
      |             ~^~~~~~~~~~~
shoes.cpp:13:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | for(int l=i*2;l<s.size();l++){
      |               ~^~~~~~~~~
shoes.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 | for(int l=i*2+1;l<s.size();l++){
      |                 ~^~~~~~~~~
#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...