제출 #294918

#제출 시각아이디문제언어결과실행 시간메모리
294918theStaticMindArranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms256 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long calculate(vector<int>& A, vector<int>& B){ long long ret = 0; for(int i = 0; i < A.size(); i++){ ret += abs(A[i] - B[i]) - (A[i] < B[i]); } return ret; } long long count_swaps(std::vector<int> s) { int n = s.size(); vector<int> A[n + 1], B[n + 1]; for(int i = 0; i < n; i++){ if(s[i] < 0) A[-s[i]].push_back(i); else B[s[i]].push_back(i); } long long cnt = 0; for(int i = 0; i <= n; i++){ cnt += calculate(A[i], B[i]); } return cnt; }

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

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