제출 #822860

#제출 시각아이디문제언어결과실행 시간메모리
822860vjudge1Arranging Shoes (IOI19_shoes)C++17
50 / 100
1087 ms1864 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { long long ans = 0; while (s.size() > 0){ for (int j = 1 ; j < s.size() ; j++){ if (s[0] * -1 == s[j]){ ans+=j - 1; if (s[0] > 0) ans++; //cout << 0 << " " << j << '\n'; s.erase(s.begin() + j, s.begin() + j + 1); s.erase(s.begin() + 0, s.begin() + 0 + 1); break ; } } } return ans; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:8:22: 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 = 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...