제출 #427026

#제출 시각아이디문제언어결과실행 시간메모리
427026Ahmadsm2005Arranging Shoes (IOI19_shoes)C++14
10 / 100
1086 ms3752 KiB
#include "shoes.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; vector<int>POS; long long count_swaps(vector<int>s){ for(int i=0;i<s.size();i++){ if(s[i]<0) POS.push_back(s[i]); } long long ANS=0; for(int i=0;i<POS.size();i++){ for(int l=i*2;l<s.size();l++){ if(s[l]==POS[i]){ for(int x=l-1;x>=i*2;x--){ swap(s[x],s[x+1]),ANS++; } break; } } for(int l=i*2+1;l<s.size();l++){ if(s[l]==-POS[i]){ for(int x=l-1;x>=i*2+1;x--) swap(s[x],s[x+1]),ANS++; break; } } } return ANS; }

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

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