Submission #296955

#TimeUsernameProblemLanguageResultExecution timeMemory
296955ASDF123Wiring (IOI17_wiring)C++17
7 / 100
1066 ms14872 KiB
#include "wiring.h" //#include "grader.cpp" #include <bits/stdc++.h> #define szof(s) (int)s.size() #define pii pair<int, int> #define ll long long #define fr first #define sc second using namespace std; const int N = (int)2e5 + 5; vector <int> g[N]; bool used[N]; struct Edge { int u, v, len; Edge(int u_, int v_, int len_) { u = u_, v = v_, len = len_; } Edge () { } }; bool operator < (const Edge &a, const Edge &b) { return a.len < b.len; } ll dp[201][201]; long long min_total_length(vector<int> r, vector<int> b) { int n = szof(r), m = szof(b); r.insert(r.begin(), 0); b.insert(b.begin(), 0); for (int i = 0; i < 201; i++) { for (int j = 0; j < 201; j++) { dp[i][j] = INT64_MAX; } } dp[0][0] = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { dp[i][j] = min({dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]}) + abs(r[i] - b[j]); } } return dp[n][m]; }
#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...