# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
426522 |
2021-06-14T06:00:08 Z |
Aldas25 |
Wombats (IOI13_wombats) |
C++14 |
|
5679 ms |
262148 KB |
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define f first
#define s second
#define pb push_back
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
typedef vector<ll> vl;
const int MAXN = 100100;
const ll INF = 1e9;
int r, c;
int h[5000][200], v[5000][200];
int dp[310][5100][310];
void calcDists () {
FOR(i, 0, c-1) {
// cout << " i = "<< i<< endl;
FOR(col, 0, c-1) dp[i][r-1][col] = INF;
//cout << " --" << endl;
dp[i][r-1][i] = 0;
for (int row = r-1; row >= 0; row--) {
// cout <<" row = " << row << endl;
if (row != r-1) {
FOR(col, 0, c-1) dp[i][row][col] = dp[i][row+1][col] + v[row][col];
}
//cout << " -" << endl;
FOR(col, 1, c-1) dp[i][row][col] = min(dp[i][row][col], dp[i][row][col-1] + h[row][col-1]);
//cout << " sfsadfa" << endl;
for (int col = c-2; col >= 0; col--) {
//cout << " col = " << col << endl;
dp[i][row][col] = min(dp[i][row][col], dp[i][row][col+1] + h[row][col]);
//cout << " ss" << endl;
}
//cout << " ------" << endl;
}
}
}
void init(int R, int C, int H[5000][200], int V[5000][200]) {
r = R;
c = C;
FOR(i, 0, r-1) FOR(j, 0, c-2)
h[i][j] = H[i][j];
FOR(i, 0, r-2) FOR(j, 0, c-1)
v[i][j] = V[i][j];
//cout<< " h" << endl;
calcDists();
// cout << " ii" << endl;
}
void changeH(int P, int Q, int W) {
h[P][Q] = W;
calcDists();
}
void changeV(int P, int Q, int W) {
v[P][Q] = W;
calcDists();
}
int escape(int V1, int V2) {
return dp[V2][0][V1];
}
Compilation message
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
15 | int res;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
14156 KB |
Output is correct |
2 |
Correct |
24 ms |
14240 KB |
Output is correct |
3 |
Correct |
107 ms |
17080 KB |
Output is correct |
4 |
Correct |
24 ms |
14236 KB |
Output is correct |
5 |
Correct |
24 ms |
14156 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
304 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
972 KB |
Output is correct |
5 |
Correct |
2 ms |
948 KB |
Output is correct |
6 |
Correct |
2 ms |
972 KB |
Output is correct |
7 |
Correct |
2 ms |
972 KB |
Output is correct |
8 |
Correct |
2 ms |
844 KB |
Output is correct |
9 |
Correct |
1 ms |
972 KB |
Output is correct |
10 |
Correct |
1 ms |
972 KB |
Output is correct |
11 |
Correct |
84 ms |
3396 KB |
Output is correct |
12 |
Correct |
1 ms |
972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1125 ms |
13336 KB |
Output is correct |
2 |
Correct |
1124 ms |
13280 KB |
Output is correct |
3 |
Correct |
1129 ms |
13552 KB |
Output is correct |
4 |
Correct |
1141 ms |
13544 KB |
Output is correct |
5 |
Correct |
1126 ms |
13424 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
5409 ms |
13540 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
28076 KB |
Output is correct |
2 |
Correct |
81 ms |
28136 KB |
Output is correct |
3 |
Correct |
80 ms |
28108 KB |
Output is correct |
4 |
Correct |
130 ms |
29520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1087 ms |
13260 KB |
Output is correct |
2 |
Correct |
1109 ms |
13280 KB |
Output is correct |
3 |
Correct |
1134 ms |
13548 KB |
Output is correct |
4 |
Correct |
1108 ms |
13548 KB |
Output is correct |
5 |
Correct |
1108 ms |
13416 KB |
Output is correct |
6 |
Correct |
87 ms |
28144 KB |
Output is correct |
7 |
Correct |
77 ms |
28132 KB |
Output is correct |
8 |
Correct |
85 ms |
28148 KB |
Output is correct |
9 |
Correct |
129 ms |
29416 KB |
Output is correct |
10 |
Correct |
26 ms |
14176 KB |
Output is correct |
11 |
Correct |
24 ms |
14120 KB |
Output is correct |
12 |
Correct |
110 ms |
16912 KB |
Output is correct |
13 |
Correct |
25 ms |
14156 KB |
Output is correct |
14 |
Correct |
30 ms |
14156 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
948 KB |
Output is correct |
19 |
Correct |
1 ms |
972 KB |
Output is correct |
20 |
Correct |
2 ms |
972 KB |
Output is correct |
21 |
Correct |
2 ms |
972 KB |
Output is correct |
22 |
Correct |
1 ms |
844 KB |
Output is correct |
23 |
Correct |
2 ms |
972 KB |
Output is correct |
24 |
Correct |
1 ms |
972 KB |
Output is correct |
25 |
Correct |
92 ms |
3364 KB |
Output is correct |
26 |
Correct |
1 ms |
972 KB |
Output is correct |
27 |
Correct |
5679 ms |
13552 KB |
Output is correct |
28 |
Runtime error |
507 ms |
262148 KB |
Execution killed with signal 9 |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1112 ms |
13336 KB |
Output is correct |
2 |
Correct |
1134 ms |
13284 KB |
Output is correct |
3 |
Correct |
1180 ms |
13552 KB |
Output is correct |
4 |
Correct |
1149 ms |
13552 KB |
Output is correct |
5 |
Correct |
1084 ms |
13436 KB |
Output is correct |
6 |
Correct |
111 ms |
28136 KB |
Output is correct |
7 |
Correct |
152 ms |
28128 KB |
Output is correct |
8 |
Correct |
90 ms |
28144 KB |
Output is correct |
9 |
Correct |
117 ms |
29528 KB |
Output is correct |
10 |
Correct |
23 ms |
14156 KB |
Output is correct |
11 |
Correct |
26 ms |
14220 KB |
Output is correct |
12 |
Correct |
107 ms |
16996 KB |
Output is correct |
13 |
Correct |
28 ms |
14220 KB |
Output is correct |
14 |
Correct |
32 ms |
14156 KB |
Output is correct |
15 |
Runtime error |
877 ms |
262148 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |