# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1036337 |
2024-07-27T09:25:16 Z |
beaconmc |
Wiring (IOI17_wiring) |
C++14 |
|
36 ms |
8792 KB |
#include "wiring.h"
#include <bits/stdc++.h>
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
ll n,m;
vector<ll> R,B;
ll cache[1000][1000];
ll dp(ll x, ll y){
if (cache[x][y] != -1) return cache[x][y];
if (x==n && y==m) return 0;
if (x>=n || y >= m) return 1000000000;
return cache[x][y] = min(dp(x+1,y), min(dp(x,y+1), dp(x+1,y+1))) + abs(R[x] - B[y]);
}
long long min_total_length(std::vector<int> r, std::vector<int> b) {
FOR(i,0,1000) FOR(j,0,1000) cache[i][j] = -1;
R = r;
B = b;
n = r.size();
m = b.size();
return dp(0,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4184 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
2 ms |
4188 KB |
Output is correct |
4 |
Correct |
2 ms |
4188 KB |
Output is correct |
5 |
Correct |
2 ms |
4188 KB |
Output is correct |
6 |
Correct |
2 ms |
4188 KB |
Output is correct |
7 |
Correct |
2 ms |
4188 KB |
Output is correct |
8 |
Correct |
2 ms |
4188 KB |
Output is correct |
9 |
Correct |
2 ms |
4184 KB |
Output is correct |
10 |
Correct |
2 ms |
4184 KB |
Output is correct |
11 |
Correct |
2 ms |
4188 KB |
Output is correct |
12 |
Correct |
2 ms |
4188 KB |
Output is correct |
13 |
Correct |
2 ms |
4376 KB |
Output is correct |
14 |
Correct |
2 ms |
4344 KB |
Output is correct |
15 |
Correct |
2 ms |
4372 KB |
Output is correct |
16 |
Correct |
2 ms |
4188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Incorrect |
29 ms |
7516 KB |
3rd lines differ - on the 1st token, expected: '41596985758595', found: '52866052' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4188 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Incorrect |
36 ms |
8792 KB |
3rd lines differ - on the 1st token, expected: '1068938599', found: '-1464804224' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4184 KB |
Output is correct |
2 |
Incorrect |
29 ms |
8164 KB |
3rd lines differ - on the 1st token, expected: '373710605', found: '-2143937918' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4184 KB |
Output is correct |
2 |
Correct |
2 ms |
4188 KB |
Output is correct |
3 |
Correct |
2 ms |
4188 KB |
Output is correct |
4 |
Correct |
2 ms |
4188 KB |
Output is correct |
5 |
Correct |
2 ms |
4188 KB |
Output is correct |
6 |
Correct |
2 ms |
4188 KB |
Output is correct |
7 |
Correct |
2 ms |
4188 KB |
Output is correct |
8 |
Correct |
2 ms |
4188 KB |
Output is correct |
9 |
Correct |
2 ms |
4184 KB |
Output is correct |
10 |
Correct |
2 ms |
4184 KB |
Output is correct |
11 |
Correct |
2 ms |
4188 KB |
Output is correct |
12 |
Correct |
2 ms |
4188 KB |
Output is correct |
13 |
Correct |
2 ms |
4376 KB |
Output is correct |
14 |
Correct |
2 ms |
4344 KB |
Output is correct |
15 |
Correct |
2 ms |
4372 KB |
Output is correct |
16 |
Correct |
2 ms |
4188 KB |
Output is correct |
17 |
Correct |
2 ms |
4188 KB |
Output is correct |
18 |
Correct |
2 ms |
4188 KB |
Output is correct |
19 |
Incorrect |
29 ms |
7516 KB |
3rd lines differ - on the 1st token, expected: '41596985758595', found: '52866052' |
20 |
Halted |
0 ms |
0 KB |
- |