제출 #221531

#제출 시각아이디문제언어결과실행 시간메모리
221531mathking1021Arranging Shoes (IOI19_shoes)C++14
50 / 100
1095 ms3192 KiB
#include "shoes.h" #include <iostream> long long count_swaps(std::vector<int> s) { typedef long long ll; using namespace std; ll cnt = 0; for(ll i = 0; i < s.size(); i+=2) { for(ll j = i + 1; j < s.size(); j++) { if(s[i] + s[j] == 0) { for(ll k = j; k >= i + 2; k--) { swap(s[k], s[k - 1]); cnt++; } break; } } if(s[i] > 0) swap(s[i], s[i + 1]), cnt++; } return cnt; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:9:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(ll i = 0; i < s.size(); i+=2)
                   ~~^~~~~~~~~~
shoes.cpp:11:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(ll j = i + 1; j < s.size(); j++)
                           ~~^~~~~~~~~~
#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...