제출 #152511

#제출 시각아이디문제언어결과실행 시간메모리
152511petar_vitoracArranging Shoes (IOI19_shoes)C++14
50 / 100
1051 ms1920 KiB
#include "shoes.h" #include <bits/stdc++.h> bool negative(int x){ if(abs(x)==x){ return false; } else{ return true; } } long long count_swaps(std::vector<int> s) { //int n=s.size()/2; int result=0; for(int i=0;i<s.size()-1;i++){ int found=-1; int j=i+1; while(found==-1){ if(s[j]==-s[i]){ found=j; } j++; } if(negative(s[i])){ result+=(found-i-1); } else{ result+=(found-i); } s.erase(s.begin()+found); } return result; }

컴파일 시 표준 에러 (stderr) 메시지

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