제출 #425605

#제출 시각아이디문제언어결과실행 시간메모리
425605Tangent전선 연결 (IOI17_wiring)C++17
0 / 100
1082 ms4452 KiB
#include "wiring.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vii> vvii; typedef vector<vll> vvll; typedef vector<vpii> vvpii; typedef vector<vpll> vvpll; #define ffor(i, a, b) for (ll i = (a); i < (b); i++) #define fford(i, a, b) for (ll i = (a); i > (b); i--) #define rep(i, n) ffor(i, 0, n) #define forin(x, a) for (auto &x: a) #define all(a) a.begin(), a.end() long long min_total_length(std::vector<int> r, std::vector<int> b) { if (r.size() > b.size()) { swap(r, b); } vll dp(b.size() + 1, 1LL << 62); dp[0] = 0; rep(i, b.size() - r.size() + 1) { dp[i + 1] = dp[i] + abs(b[i] - r[0]); } ffor(j, 1, r.size()) { vll ndp(b.size() + 1, 1LL << 62); ffor(i, j, b.size() - r.size() + j + 1) { ll curr = 0; rep(k, i - j + 1) { curr += abs(b[i - k] - r[j]); ndp[i + 1] = min(ndp[i + 1], dp[i- k] + curr); } } dp = move(ndp); } return dp.back(); }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:18:42: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ffor(i, a, b) for (ll i = (a); i < (b); i++)
      |                                          ^
wiring.cpp:20:19: note: in expansion of macro 'ffor'
   20 | #define rep(i, n) ffor(i, 0, n)
      |                   ^~~~
wiring.cpp:30:2: note: in expansion of macro 'rep'
   30 |  rep(i, b.size() - r.size() + 1) {
      |  ^~~
wiring.cpp:18:42: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | #define ffor(i, a, b) for (ll i = (a); i < (b); i++)
      |                                          ^
wiring.cpp:33:2: note: in expansion of macro 'ffor'
   33 |  ffor(j, 1, r.size()) {
      |  ^~~~
wiring.cpp:18:42: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'long long unsigned int' [-Wsign-compare]
   18 | #define ffor(i, a, b) for (ll i = (a); i < (b); i++)
      |                                          ^
wiring.cpp:35:3: note: in expansion of macro 'ffor'
   35 |   ffor(i, j, b.size() - r.size() + j + 1) {
      |   ^~~~
#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...