Submission #93701

# Submission time Handle Problem Language Result Execution time Memory
93701 2019-01-10T18:24:40 Z someone_aa Wiring (IOI17_wiring) C++17
7 / 100
198 ms 72760 KB
#include <bits/stdc++.h>
#include "wiring.h"
#define ll long long
#define mp make_pair
#define pb push_back

using namespace std;
const int maxn = 2100;
vector<pair<int, char> > v;
ll dp[maxn][maxn];
int n;

long long min_total_length(std::vector<int> r, std::vector<int> b) {
    for(int i=0;i<=r.size();i++) {
        for(int j=0;j<=b.size();j++) {
            dp[i][j] = (1LL << 45);
        }
    }
    dp[0][0] = 0LL;
    for(int i=1;i<=r.size();i++) {
        for(int j=1;j<=b.size();j++) {
            dp[i][j] = min(min(dp[i-1][j], dp[i][j-1]), dp[i-1][j-1]) + abs(r[i-1] - b[j-1]);
        }
    }
    return dp[r.size()][b.size()];
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<=r.size();i++) {
                 ~^~~~~~~~~~
wiring.cpp:15:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<=b.size();j++) {
                     ~^~~~~~~~~~
wiring.cpp:20:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<=r.size();i++) {
                 ~^~~~~~~~~~
wiring.cpp:21:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=1;j<=b.size();j++) {
                     ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 15 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1400 KB Output is correct
9 Correct 3 ms 1404 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1400 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 3 ms 1404 KB Output is correct
15 Correct 3 ms 1400 KB Output is correct
16 Correct 3 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 1276 KB Output is correct
3 Runtime error 141 ms 71944 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Runtime error 198 ms 72720 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 188 ms 72760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 15 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 1400 KB Output is correct
8 Correct 3 ms 1400 KB Output is correct
9 Correct 3 ms 1404 KB Output is correct
10 Correct 3 ms 1400 KB Output is correct
11 Correct 3 ms 1400 KB Output is correct
12 Correct 3 ms 1528 KB Output is correct
13 Correct 3 ms 1400 KB Output is correct
14 Correct 3 ms 1404 KB Output is correct
15 Correct 3 ms 1400 KB Output is correct
16 Correct 3 ms 1400 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 1276 KB Output is correct
19 Runtime error 141 ms 71944 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Halted 0 ms 0 KB -