# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1036456 |
2024-07-27T11:34:38 Z |
c2zi6 |
Wombats (IOI13_wombats) |
C++14 |
|
222 ms |
262144 KB |
#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;
const int PARTMAXVAL = 1e9;
struct PART;
PART combine(PART& a, PART& b);
struct PART {
int d[MAXC][MAXC];
PART() {
rep(i, MAXC) rep(j, MAXC) d[i][j] = PARTMAXVAL;
}
int* operator[](int i) {
return d[i];
}
void combine(PART& b) {
*this = ::combine(*this, b);
}
};
int n, m;
VVI H, V;
PART combine(PART& a, PART& b) {
PART c;
int mid[MAXC][MAXC];
reprl(d, +MAXC, -MAXC) rep(i, MAXC) {
int j = i-d;
if (j < 0 || j >= MAXC) continue;
int mn = 0;
int mx = MAXC-1;
if (j-1 >= 0) mn = mid[i][j-1];
if (i+1 < MAXC) mx = mid[i+1][j];
mid[i][j] = mx;
replr(m, mn, mx) {
if (a[i][m] + b[m][j] < c[i][j]) {
c[i][j] = a[i][m] + b[m][j];
mid[i][j] = m;
}
}
}
return c;
}
void recalcpart(PART& p, int l) {
replr(i, 0, m-1) {
int sum = 0;
replr(j, i, m-1) {
p[i][j] = sum + V[l][j];
p[j][i] = sum + V[l][i];
sum += H[l][j];
}
}
}
struct SEGTREE {
int n;
vector<PART> tree;
SEGTREE(){}
SEGTREE(int sz) {
n = 1;
while (n < sz) n *= 2;
tree = vector<PART>(2*n);
for (PART& p : tree) {
rep(i, MAXC) p[i][i] = 0;
}
}
void upd(int N, int L, int R, int i) {
if (i < L || i > R) return;
if (L == R) {
recalcpart(tree[N], i);
return;
}
int M = (L + R) / 2;
upd(2*N+1, L, M, i);
upd(2*N+2, M+1, R, i);
tree[N] = combine(tree[2*N+1], tree[2*N+2]);
}
void upd(int i) {
upd(0, 0, n-1, i);
}
} seg;
void init(int R, int C, int H_arg[5000][200], int V_arg[5000][200]) {
n = R;
m = C;
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();*/
seg = SEGTREE(n);
rep(i, n) seg.upd(i);
}
void changeH(int P, int Q, int W) {
H[P][Q] = W;
seg.upd(P);
}
void changeV(int P, int Q, int W) {
V[P][Q] = W;
seg.upd(P);
}
int escape(int u, int v) {
return seg.tree[0][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;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
109 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
7 ms |
2908 KB |
Output is correct |
5 |
Correct |
7 ms |
3084 KB |
Output is correct |
6 |
Correct |
7 ms |
2908 KB |
Output is correct |
7 |
Correct |
7 ms |
3008 KB |
Output is correct |
8 |
Correct |
7 ms |
3088 KB |
Output is correct |
9 |
Correct |
6 ms |
2908 KB |
Output is correct |
10 |
Correct |
7 ms |
3088 KB |
Output is correct |
11 |
Correct |
45 ms |
5220 KB |
Output is correct |
12 |
Correct |
7 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
10844 KB |
Output is correct |
2 |
Correct |
83 ms |
10884 KB |
Output is correct |
3 |
Correct |
91 ms |
10752 KB |
Output is correct |
4 |
Correct |
94 ms |
10900 KB |
Output is correct |
5 |
Correct |
99 ms |
10840 KB |
Output is correct |
6 |
Correct |
0 ms |
600 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
0 ms |
604 KB |
Output is correct |
9 |
Correct |
222 ms |
10844 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
106 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
10844 KB |
Output is correct |
2 |
Correct |
90 ms |
10844 KB |
Output is correct |
3 |
Correct |
97 ms |
10916 KB |
Output is correct |
4 |
Correct |
96 ms |
10908 KB |
Output is correct |
5 |
Correct |
101 ms |
10844 KB |
Output is correct |
6 |
Runtime error |
106 ms |
262144 KB |
Execution killed with signal 9 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
10904 KB |
Output is correct |
2 |
Correct |
85 ms |
10896 KB |
Output is correct |
3 |
Correct |
96 ms |
10844 KB |
Output is correct |
4 |
Correct |
99 ms |
10896 KB |
Output is correct |
5 |
Correct |
103 ms |
10888 KB |
Output is correct |
6 |
Runtime error |
102 ms |
262144 KB |
Execution killed with signal 9 |
7 |
Halted |
0 ms |
0 KB |
- |