# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1036342 |
2024-07-27T09:37:10 Z |
beaconmc |
Wiring (IOI17_wiring) |
C++14 |
|
1000 ms |
207700 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;
map<vector<ll>, ll> cache;
ll dp(ll x, ll y){
if (abs(x-y) > 10) return 1000000000;
if (cache.count({x,y})) 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) {
R = r;
B = b;
n = r.size();
m = b.size();
return dp(0,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Incorrect |
2 ms |
692 KB |
3rd lines differ - on the 1st token, expected: '445668', found: '446967' |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Incorrect |
1 ms |
604 KB |
3rd lines differ - on the 1st token, expected: '84383', found: '1000007275' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
1100 ms |
207700 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
1036 ms |
195664 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Incorrect |
2 ms |
692 KB |
3rd lines differ - on the 1st token, expected: '445668', found: '446967' |
8 |
Halted |
0 ms |
0 KB |
- |