-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboj.10251.cc
79 lines (66 loc) · 1.82 KB
/
boj.10251.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef const ll cll;
typedef queue<ll> qll;
typedef queue<pll> qpll;
typedef priority_queue<ll> pqll;
typedef priority_queue<pll> pqpll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
#define FOR1(a, A) for (ll a = 0; a < A; ++a)
#define FOR2(a, b, A, B) \
for (ll a = 0; a < A; ++a) \
for (ll b = 0; b < B; ++b)
cll M = 100, N = 100, L = 10, G = 1e6, INF = 1e7;
ll m, n, fuels[M][N][2] = {{{}}};
ll dp[M][N][2][M + N] = {{{{}}}};
// 0 => rightside, 1 => downside;
bool isValid(ll i, ll l) { return i >= 0 && i < m && l >= 0 && l < n; }
ll solve(ll speed, ll fuel) {
ll result;
memset(dp, 0x3f3f3f3f, sizeof(dp));
dp[0][0][0][0] = dp[0][0][1][0] = 0;
for (ll i = 1; i < n; ++i) {
dp[0][i][0][0] = dp[0][i - 1][0][0] + fuels[0][i - 1][0];
dp[0][i][1][1] = dp[0][i][0][0];
}
for (ll i = 1; i < m; ++i) {
dp[i][0][0][1] = dp[i - 1][0][0][1] + fuels[i - 1][0][1];
dp[i][0][1][0] = dp[i][0][0][1];
}
for (ll i = 1; i < m; ++i) {
for (ll l = 1; l < n; ++l) {
// hererer
}
}
return result != INF ? result : -1;
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t, l, g;
cin >> t;
while (t--) {
cin >> m >> n >> l >> g;
memset(fuels, -1, sizeof(fuels));
for (ll i = 0; i < m; ++i) {
for (ll j = 0; j < n - 1; ++j) {
cin >> fuels[i][j][0];
}
}
for (ll i = 0; i < m - 1; ++i) {
for (ll j = 0; j < n; ++j) {
cin >> fuels[i][j][1];
}
}
cout << solve(l, g) << "\n";
}
return 0;
}