Submission #425616

#TimeUsernameProblemLanguageResultExecution timeMemory
425616TangentWiring (IOI17_wiring)C++17
0 / 100
1 ms204 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) { vvll dp(r.size() + 1, vll(b.size() + 1, 1ll << 62)); dp[0][0] = 0; ffor(i, 1, r.size() + 1) { ffor(j, 1, b.size() + 1) { ll curr = 0; rep(k, j) { curr += abs(b[j - k - 1] - r[i - 1]); dp[i][j] = min(dp[i][j], dp[i - 1][j - k - 1] + curr); } } } return dp.back().back(); }

Compilation message (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:27:2: note: in expansion of macro 'ffor'
   27 |  ffor(i, 1, 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:28:3: note: in expansion of macro 'ffor'
   28 |   ffor(j, 1, b.size() + 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...