#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "wombats.h"
const int MAXC = 100;
int n, m;
struct PART {
int d[MAXC][MAXC];
PART() {
clear();
}
void clear() {
rep(i, m) rep(j, m) d[i][j] = 2e9;
}
void add(const PART& b) {
PART c;
rep(u, m) rep(v, m) rep(mid, m) {
setmin(c.d[u][v], d[u][mid] + b.d[mid][v]);
}
rep(u, m) rep(v, m) d[u][v] = c.d[u][v];
}
};
void combine(const PART& a, const PART& b) {
PART c;
rep(u, m) rep(v, m) rep(mid, m) {
setmin(c.d[u][v], a.d[u][mid] + b.d[mid][v]);
}
}
vector<PART> a;
PART answer;
VVI H, V;
void recalc() {
rep(u, n) a[u].clear();
rep(u, n) {
replr(i, 0, m-1) {
int sum = 0;
replr(j, i, m-1) {
a[u].d[i][j] = sum + V[u][j];
a[u].d[j][i] = sum + V[u][i];
sum += H[u][j];
}
}
}
answer = a[0];
replr(i, 1, n-1) answer.add(a[i]);
}
void init(int R, int C, int H_arg[5000][200], int V_arg[5000][200]) {
n = R;
m = C;
a = vector<PART>(n);
H = V = VVI(n, VI(m));
rep(i, n) rep(j, m-1) H[i][j] = H_arg[i][j];
rep(i, n-1) rep(j, m) V[i][j] = V_arg[i][j];
recalc();
}
void changeH(int P, int Q, int W) {
H[P][Q] = W;
recalc();
/* ... */
}
void changeV(int P, int Q, int W) {
V[P][Q] = W;
recalc();
/* ... */
}
int escape(int u, int v) {
return answer.d[u][v];
}
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;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
148 ms |
25180 KB |
Output is correct |
2 |
Correct |
132 ms |
25180 KB |
Output is correct |
3 |
Correct |
160 ms |
27988 KB |
Output is correct |
4 |
Correct |
119 ms |
25180 KB |
Output is correct |
5 |
Correct |
117 ms |
25180 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
704 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
41 ms |
3060 KB |
Output is correct |
12 |
Correct |
2 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7655 ms |
4708 KB |
Output is correct |
2 |
Correct |
6958 ms |
4700 KB |
Output is correct |
3 |
Correct |
7570 ms |
4760 KB |
Output is correct |
4 |
Correct |
7960 ms |
4700 KB |
Output is correct |
5 |
Correct |
7264 ms |
4700 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Execution timed out |
20059 ms |
4700 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
189 ms |
31124 KB |
Output is correct |
2 |
Correct |
164 ms |
31128 KB |
Output is correct |
3 |
Correct |
189 ms |
31200 KB |
Output is correct |
4 |
Correct |
214 ms |
32592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7846 ms |
4704 KB |
Output is correct |
2 |
Correct |
7530 ms |
4696 KB |
Output is correct |
3 |
Correct |
7431 ms |
4696 KB |
Output is correct |
4 |
Correct |
7839 ms |
4700 KB |
Output is correct |
5 |
Correct |
7370 ms |
4700 KB |
Output is correct |
6 |
Correct |
193 ms |
31068 KB |
Output is correct |
7 |
Correct |
165 ms |
31180 KB |
Output is correct |
8 |
Correct |
205 ms |
31208 KB |
Output is correct |
9 |
Correct |
214 ms |
32336 KB |
Output is correct |
10 |
Correct |
149 ms |
25180 KB |
Output is correct |
11 |
Correct |
114 ms |
25180 KB |
Output is correct |
12 |
Correct |
162 ms |
28016 KB |
Output is correct |
13 |
Correct |
124 ms |
25180 KB |
Output is correct |
14 |
Correct |
115 ms |
25180 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
860 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
47 ms |
3152 KB |
Output is correct |
26 |
Correct |
1 ms |
600 KB |
Output is correct |
27 |
Execution timed out |
20089 ms |
4636 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7735 ms |
4704 KB |
Output is correct |
2 |
Correct |
6773 ms |
4700 KB |
Output is correct |
3 |
Correct |
7265 ms |
4696 KB |
Output is correct |
4 |
Correct |
7043 ms |
4700 KB |
Output is correct |
5 |
Correct |
7110 ms |
4696 KB |
Output is correct |
6 |
Correct |
191 ms |
31064 KB |
Output is correct |
7 |
Correct |
168 ms |
31068 KB |
Output is correct |
8 |
Correct |
184 ms |
31196 KB |
Output is correct |
9 |
Correct |
216 ms |
32468 KB |
Output is correct |
10 |
Correct |
116 ms |
25180 KB |
Output is correct |
11 |
Correct |
120 ms |
25180 KB |
Output is correct |
12 |
Correct |
139 ms |
28024 KB |
Output is correct |
13 |
Correct |
101 ms |
25432 KB |
Output is correct |
14 |
Correct |
109 ms |
25180 KB |
Output is correct |
15 |
Runtime error |
2446 ms |
262144 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |