제출 #552527

#제출 시각아이디문제언어결과실행 시간메모리
552527timreizinWiring (IOI17_wiring)C++17
7 / 100
146 ms262144 KiB
#include "wiring.h" #include <vector> #include <cmath> using namespace std; using ll = long long; ll min_total_length(vector<int> r, vector<int> b) { vector<vector<ll>> dp(r.size(), vector<ll>(b.size())); for (int i = 0; i < b.size(); ++i) { dp[0][i] = abs(r[0] - b[i]); if (i != 0) dp[0][i] += dp[0][i - 1]; } for (int i = 1; i < r.size(); ++i) { for (int j = 0; j < b.size(); ++j) { dp[i][j] = dp[i - 1][j] + abs(r[i] - b[j]); ll sum = 0; for (int k = j - 1; k >= 0; --k) { sum += abs(r[i] - b[k + 1]); dp[i][j] = min(dp[i][j], dp[i - 1][k] + sum); } } } return dp.back().back(); }

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

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