제출 #406033

#제출 시각아이디문제언어결과실행 시간메모리
406033ngraceArranging Shoes (IOI19_shoes)C++14
65 / 100
33 ms3108 KiB
#include "shoes.h" long long count_swaps(std::vector<int> s) { int n=s.size()/2; if(n<=1000){//sub 1, 2 and 5 long long out=0; for(int i=0;i<n*2;i+=2){ int cur=s[i]; int ind=i+1; while(s[ind]!=-cur) ind++; while(ind>i+1){ int tmp=s[ind]; s[ind]=s[ind-1]; s[ind-1]=tmp; ind--; out++; } if(s[i]>s[i+1]){ out++; } } return out; } else{ //assume sub 4 long long out=0; for(int i=0;i<s.size()/2;i++){ out+=i; } return out; } }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   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...