# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
126074 |
2019-07-07T02:16:41 Z |
nxteru |
Wombats (IOI13_wombats) |
C++14 |
|
885 ms |
262144 KB |
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000001
struct node{
int n,d[200][200];
void ini(int x){
n=x;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==j)d[i][j]=0;
else d[i][j]=INF;
}
}
}
node plus(node &q){
node res;
res.ini(n);
int a[205][205];
for(int i=n-1;i>-n;i--){
for(int j=max(-i,0);i+j<n&&j<n;j++){
int x,y;
if(j-1>=0)x=a[i+j][j-1];
else x=0;
if(i+j+1<n)y=a[i+j+1][j];
else y=n-1;
for(int k=x;k<=y;k++)if(d[i+j][k]+q.d[k][j]<d[i+j][x]+q.d[x][j])x=k;
a[i+j][j]=x;
res.d[i+j][j]=min(d[i+j][x]+q.d[x][j],INF);
}
}
return res;
}
};
struct SEG{
int n;
node seg[1<<10];
void ini(int x){
n=x;
for(int i=0;i<1<<10;i++)seg[i].ini(n);
}
void up(int a,node &q){
a+=(1<<9)-1;
seg[a]=q;
while(a>0){
a=(a-1)/2;
seg[a]=seg[a*2+1].plus(seg[a*2+2]);
}
}
};
int h[5005][205],w[5005][205],n,m,p[205];
SEG s;
void change(int x){
p[0]=0;
for(int i=1;i<m;i++)p[i]=p[i-1]+h[x][i-1];
node res;
res.ini(m);
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
res.d[i][j]=p[max(i,j)]-p[min(i,j)]+w[x][j];
}
}
s.up(x,res);
}
void init(int R, int C, int H[5000][200], int V[5000][200]) {
n=R,m=C;
s.ini(m);
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++)w[i][j]=V[i][j];
for(int i=0;i<n;i++)change(i);
}
void changeH(int a, int b, int x) {
h[a][b]=x;
change(a);
}
void changeV(int a, int b, int x) {
w[a][b]=x;
change(a);
}
int escape(int a, int b) {
return s.seg[0].d[a][b];
}
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 |
Runtime error |
450 ms |
262144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
6520 KB |
Output is correct |
2 |
Correct |
7 ms |
6392 KB |
Output is correct |
3 |
Correct |
7 ms |
6520 KB |
Output is correct |
4 |
Correct |
28 ms |
26360 KB |
Output is correct |
5 |
Correct |
26 ms |
26360 KB |
Output is correct |
6 |
Correct |
26 ms |
26420 KB |
Output is correct |
7 |
Correct |
29 ms |
26488 KB |
Output is correct |
8 |
Correct |
25 ms |
25464 KB |
Output is correct |
9 |
Correct |
26 ms |
26232 KB |
Output is correct |
10 |
Correct |
27 ms |
25592 KB |
Output is correct |
11 |
Correct |
103 ms |
28792 KB |
Output is correct |
12 |
Correct |
26 ms |
26360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
386 ms |
100280 KB |
Output is correct |
2 |
Correct |
348 ms |
99464 KB |
Output is correct |
3 |
Correct |
387 ms |
100316 KB |
Output is correct |
4 |
Correct |
409 ms |
100344 KB |
Output is correct |
5 |
Correct |
376 ms |
99656 KB |
Output is correct |
6 |
Correct |
7 ms |
6392 KB |
Output is correct |
7 |
Correct |
7 ms |
6524 KB |
Output is correct |
8 |
Correct |
7 ms |
6392 KB |
Output is correct |
9 |
Correct |
885 ms |
100340 KB |
Output is correct |
10 |
Correct |
10 ms |
9208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
450 ms |
262144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
382 ms |
100192 KB |
Output is correct |
2 |
Correct |
362 ms |
99684 KB |
Output is correct |
3 |
Correct |
388 ms |
100216 KB |
Output is correct |
4 |
Correct |
391 ms |
100308 KB |
Output is correct |
5 |
Correct |
401 ms |
99596 KB |
Output is correct |
6 |
Runtime error |
467 ms |
262144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
387 ms |
100344 KB |
Output is correct |
2 |
Correct |
357 ms |
99468 KB |
Output is correct |
3 |
Correct |
388 ms |
100348 KB |
Output is correct |
4 |
Correct |
391 ms |
100216 KB |
Output is correct |
5 |
Correct |
380 ms |
99704 KB |
Output is correct |
6 |
Runtime error |
471 ms |
262144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Halted |
0 ms |
0 KB |
- |