제출 #282680

#제출 시각아이디문제언어결과실행 시간메모리
282680medmdgArranging Shoes (IOI19_shoes)C++14
50 / 100
1085 ms3192 KiB
#include <bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> S){ int ans=0; while(S.size()){ int count=0; if(S[0]>0) count ++; for(int i=1;i<S.size();i++){ if(S[i]==-1*S[0]){ count += i-1; S.erase(S.begin()+i); S.erase(S.begin()); break; } } ans+=count; } return ans; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         for(int i=1;i<S.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...