제출 #383780

#제출 시각아이디문제언어결과실행 시간메모리
383780meperdonas203Arranging Shoes (IOI19_shoes)C++17
45 / 100
40 ms1900 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { for(int i=0;i<s.size();i++){ s[i]=(s[i]<0)?-1:1; } long long int suma=0; long long int movs=0; for(auto i:s){ if(i<0){ if(suma>0){ movs+=suma; } suma+=i; }else{ suma+=i; if(suma<0){ movs+=abs(suma); } } } return movs; }

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

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