제출 #284647

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

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:6:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  for(int i = 0; i < s.size(); i += 2){
      |                 ~~^~~~~~~~~~
shoes.cpp:8:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |       for(int j = i + 1; j < s.size(); ++j){
      |                          ~~^~~~~~~~~~
shoes.cpp:18:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |       for(int 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...