Submission #1045623

#TimeUsernameProblemLanguageResultExecution timeMemory
1045623becaidoWiring (IOI17_wiring)C++17
7 / 100
16 ms5448 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,popcnt,sse4,abm") #include <bits/stdc++.h> using namespace std; #ifdef WAIMAI #include "grader.cpp" #else #include "wiring.h" #endif #ifdef WAIMAI #define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE) void dout() {cout << '\n';} template<typename T, typename...U> void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);} #else #define debug(...) 7122 #endif #define ll long long #define Waimai ios::sync_with_stdio(false), cin.tie(0) #define FOR(x,a,b) for (int x = a, I = b; x <= I; x++) #define pb emplace_back #define F first #define S second const ll INF = 1e18; const int SIZE = 205; int n, m; int a[SIZE], b[SIZE]; ll dp[SIZE][SIZE]; ll min_total_length(vector<int> _r, vector<int> _b) { n = _r.size(); m = _b.size(); FOR (i, 1, n) a[i] = _r[i - 1]; FOR (i, 1, m) b[i] = _b[i - 1]; FOR (i, 1, n) FOR (j, 1, m) { dp[i][j] = INF; if (i > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j]); if (j > 1) dp[i][j] = min(dp[i][j], dp[i][j - 1]); if (i > 1 && j > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]); if (i == 1 && j == 1) dp[i][j] = 0; dp[i][j] += abs(a[i] - b[j]); } return dp[n][m]; } /* in1 4 5 1 2 3 7 0 4 5 9 10 out1 10 */
#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...