Submission #145388

#TimeUsernameProblemLanguageResultExecution timeMemory
145388MinnakhmetovWiring (IOI17_wiring)C++14
7 / 100
42 ms6332 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define all(aaa) aaa.begin(), aaa.end() const ll INF = 1e18; const int N = 205; ll dp[N][N]; ll upd(ll &a, ll b) { a = min(a, b); } ll min_total_length(vector<int> r, vector<int> b) { int n = r.size(), m = b.size(); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { dp[i][j] = INF; } } dp[0][0] = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ll val = dp[i][j] + abs(r[i] - b[j]); upd(dp[i + 1][j], val); upd(dp[i][j + 1], val); upd(dp[i + 1][j + 1], val); } } return dp[n][m]; }

Compilation message (stderr)

wiring.cpp: In function 'long long int upd(long long int&, long long int)':
wiring.cpp:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#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...