Submission #586813

#TimeUsernameProblemLanguageResultExecution timeMemory
586813MohamedFaresNebili전선 연결 (IOI17_wiring)C++14
0 / 100
0 ms212 KiB
#include <bits/stdc++.h>
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")

        using namespace std;

        using ll = long long;
        using ii = pair<ll, ll>;
        using vi = vector<int>;

        #define ff first
        #define ss second
        #define pb push_back
        #define all(x) (x).begin(), (x).end()
        #define lb lower_bound

        const int MOD = 1000 * 1000 * 1000 + 7;

        ll DP[201][201];
        ll min_total_length(vector<int> R, vector<int> B) {
            int N = R.size(), M = B.size();
            for(int l = 0; l <= N; l++)
                for(int i = 0; i <= M; i++)
                    DP[l][i] = 1e18 + 7;
            DP[0][0] = 0;
            for(int l = 1; l <= N; l++)
                for(int i = 1; i <= M; i++)
                    DP[l][i] = min({DP[l][i - 1], DP[l - 1][i - 1],
                                   DP[l][i - 1]}) + abs(R[l - 1] - B[i - 1]);
            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...