제출 #384197

#제출 시각아이디문제언어결과실행 시간메모리
384197meperdonas203Arranging Shoes (IOI19_shoes)C++17
50 / 100
1093 ms3308 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { int movs=0; for(int i=0;i<s.size();i+=2){ for(int j=i+1;j<s.size();j++){ if(abs(s[i])==abs(s[j])and (s[i]!=s[j])){ int pos_r=0; pos_r=j; while(pos_r>i+1){ swap(s[pos_r],s[pos_r-1]); pos_r--; movs++; } if(s[i]>s[i+1]){ movs++; } break; } } } return movs; }

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

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