# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
260095 |
2020-08-09T09:49:19 Z |
SamAnd |
Wombats (IOI13_wombats) |
C++17 |
|
20000 ms |
60664 KB |
#pragma GCC optimize("Ofast")
#include "wombats.h"
//#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
const int N = 5003, M = 202, INF = 1000000009;
int n, m;
int h[N][N], v[N][N];
int ans[M][M];
int dp[N][M];
void clc()
{
for (int f = 0; f < m; ++f)
{
for (int i = n - 1; i >= 0; --i)
{
if (i == n - 1)
{
for (int j = 0; j < m; ++j)
{
if (j == f)
dp[i][j] = 0;
else
dp[i][j] = INF;
}
}
else
{
for (int j = 0; j < m; ++j)
{
dp[i][j] = dp[i + 1][j] + v[i][j];
}
}
int minu = INF;
for (int j = 0; j < m; ++j)
{
dp[i][j] = min(dp[i][j], minu);
minu = min(minu, dp[i][j]);
minu += h[i][j];
}
minu = INF;
for (int j = m - 1; j >= 0; --j)
{
dp[i][j] = min(dp[i][j], minu);
minu = min(minu, dp[i][j]);
if (j)
minu += h[i][j - 1];
}
}
for (int s = 0; s < m; ++s)
{
ans[s][f] = dp[0][s];
}
}
}
void init(int R, int C, int H[5000][200], int V[5000][200])
{
n = R;
m = C;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m - 1; ++j)
{
h[i][j] = H[i][j];
}
}
for (int i = 0; i < n - 1; ++i)
{
for (int j = 0; j < m; ++j)
{
v[i][j] = V[i][j];
}
}
clc();
}
void changeH(int P, int Q, int W)
{
h[P][Q] = W;
clc();
}
void changeV(int P, int Q, int W)
{
v[P][Q] = W;
clc();
}
int escape(int V1, int V2)
{
return ans[V1][V2];
}
Compilation message
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int res;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
28544 KB |
Output is correct |
2 |
Correct |
67 ms |
28612 KB |
Output is correct |
3 |
Correct |
158 ms |
30328 KB |
Output is correct |
4 |
Correct |
80 ms |
28544 KB |
Output is correct |
5 |
Correct |
77 ms |
28536 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
380 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
512 KB |
Output is correct |
6 |
Correct |
1 ms |
512 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Correct |
1 ms |
640 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
1 ms |
512 KB |
Output is correct |
11 |
Correct |
92 ms |
1712 KB |
Output is correct |
12 |
Correct |
1 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
722 ms |
1652 KB |
Output is correct |
2 |
Correct |
328 ms |
1640 KB |
Output is correct |
3 |
Correct |
730 ms |
1664 KB |
Output is correct |
4 |
Correct |
723 ms |
1784 KB |
Output is correct |
5 |
Correct |
683 ms |
1784 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1861 ms |
1656 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
198 ms |
52612 KB |
Output is correct |
2 |
Correct |
179 ms |
52576 KB |
Output is correct |
3 |
Correct |
205 ms |
52600 KB |
Output is correct |
4 |
Correct |
240 ms |
53392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
712 ms |
1536 KB |
Output is correct |
2 |
Correct |
311 ms |
1536 KB |
Output is correct |
3 |
Correct |
731 ms |
1656 KB |
Output is correct |
4 |
Correct |
701 ms |
1784 KB |
Output is correct |
5 |
Correct |
741 ms |
1784 KB |
Output is correct |
6 |
Correct |
196 ms |
52616 KB |
Output is correct |
7 |
Correct |
177 ms |
52600 KB |
Output is correct |
8 |
Correct |
201 ms |
52728 KB |
Output is correct |
9 |
Correct |
242 ms |
53424 KB |
Output is correct |
10 |
Correct |
77 ms |
28544 KB |
Output is correct |
11 |
Correct |
75 ms |
28792 KB |
Output is correct |
12 |
Correct |
155 ms |
30324 KB |
Output is correct |
13 |
Correct |
75 ms |
28544 KB |
Output is correct |
14 |
Correct |
74 ms |
28672 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
0 ms |
384 KB |
Output is correct |
17 |
Correct |
0 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
1 ms |
512 KB |
Output is correct |
20 |
Correct |
1 ms |
512 KB |
Output is correct |
21 |
Correct |
1 ms |
512 KB |
Output is correct |
22 |
Correct |
1 ms |
512 KB |
Output is correct |
23 |
Correct |
1 ms |
512 KB |
Output is correct |
24 |
Correct |
1 ms |
512 KB |
Output is correct |
25 |
Correct |
98 ms |
1656 KB |
Output is correct |
26 |
Correct |
1 ms |
512 KB |
Output is correct |
27 |
Correct |
1814 ms |
1780 KB |
Output is correct |
28 |
Execution timed out |
20058 ms |
56852 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
715 ms |
1656 KB |
Output is correct |
2 |
Correct |
326 ms |
1536 KB |
Output is correct |
3 |
Correct |
715 ms |
1664 KB |
Output is correct |
4 |
Correct |
702 ms |
1784 KB |
Output is correct |
5 |
Correct |
689 ms |
1656 KB |
Output is correct |
6 |
Correct |
200 ms |
52600 KB |
Output is correct |
7 |
Correct |
181 ms |
52500 KB |
Output is correct |
8 |
Correct |
201 ms |
52600 KB |
Output is correct |
9 |
Correct |
242 ms |
53368 KB |
Output is correct |
10 |
Correct |
77 ms |
28544 KB |
Output is correct |
11 |
Correct |
75 ms |
28664 KB |
Output is correct |
12 |
Correct |
158 ms |
30328 KB |
Output is correct |
13 |
Correct |
76 ms |
28536 KB |
Output is correct |
14 |
Correct |
74 ms |
28544 KB |
Output is correct |
15 |
Correct |
4050 ms |
60664 KB |
Output is correct |
16 |
Execution timed out |
20090 ms |
60664 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |