제출 #420721

#제출 시각아이디문제언어결과실행 시간메모리
420721AugustinasJucas전선 연결 (IOI17_wiring)C++14
0 / 100
23 ms4292 KiB
#include <bits/stdc++.h> #include "wiring.h" using namespace std; vector<int> r, b; const int inf = 1e9; long long linf = 1e18; long long dp[201][201] = {}; long long min_total_length(vector<int> r, vector<int> b) { int n = r.size(); int m = b.size(); for(int i = 0; i < 201; i++) for(int j = 0; j < 201; j++) dp[i][j] = linf; dp[0][0] = 0; if(r.back() > b[0]){ long long ret = 0; for(int i = 0; i < min(r.size(), b.size()); i++){ ret += b[i] - r[i]; } for(int i = min(r.size(), b.size()); i < r.size(); i++){ ret += b[0] - r[i]; } for(int i = min(r.size(), b.size()); i < b.size(); i++){ ret += b[i] - r.back(); } return ret; } for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(i + j == 0) continue; dp[i][j] = min(dp[i][j], abs(r[i-1] - b[j-1]) + dp[i-1][j-1]); dp[i][j] = min(dp[i][j], abs(r[i-1] - b[j-1]) + dp[i-1][j]); dp[i][j] = min(dp[i][j], abs(r[i-1] - b[j-1]) + dp[i][j-1]); } } return dp[n][m]; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
   16 |   for(int i = 0; i < min(r.size(), b.size()); i++){
      |                  ~~^~~~~~~~~~~~~~~~~~~~~~~~~
wiring.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for(int i = min(r.size(), b.size()); i < r.size(); i++){
      |                                        ~~^~~~~~~~~~
wiring.cpp:22:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for(int i = min(r.size(), b.size()); i < b.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...