# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
227180 |
2020-04-26T11:05:59 Z |
urd05 |
Wombats (IOI13_wombats) |
C++14 |
|
20000 ms |
24364 KB |
#include <bits/stdc++.h>
#include "wombats.h"
using namespace std;
struct Node {
int arr[200][200];
};
int r,c;
const int bs=121;
int opt[200][200];
inline Node merge(const Node& l,const Node& r) {
Node ret;
for(int diff=-c+1;diff<=c-1;diff++) {
for(int i=max(-diff,0);i<min(c-diff,c);i++) {
int j=i+diff;
int mini=2e9;
for(int k=(j==0?0:opt[i][j-1]);k<=(i==c-1?c-1:opt[i+1][j]);k++) {
if (l.arr[i][k]+r.arr[k][j]<mini) {
opt[i][j]=k;
mini=l.arr[i][k]+r.arr[k][j];
}
}
ret.arr[i][j]=mini;
}
}
return ret;
}
Node tp;
Node arr[45];
int h[5000][199];
int v[4999][200];
int dist[200];
void update(int node,int nodel,int noder) {
for(int st=0;st<c;st++) {
dist[st]=0;
for(int i=st-1;i>=0;i--) {
dist[i]=dist[i+1]+h[nodel][i];
}
for(int i=st+1;i<c;i++) {
dist[i]=dist[i-1]+h[nodel][i-1];
}
for(int i=nodel+1;i<=noder;i++) {
for(int j=0;j<c;j++) {
dist[j]=dist[j]+v[i-1][j];
}
for(int j=1;j<c;j++) {
dist[j]=min(dist[j],dist[j-1]+h[i][j-1]);
}
for(int j=c-2;j>=0;j--) {
dist[j]=min(dist[j],dist[j+1]+h[i][j]);
}
}
for(int i=0;i<c;i++) {
arr[node].arr[st][i]=dist[i];
}
}
}
void init(int rr,int cc,int hh[][200],int vv[][200]) {
r=rr;
c=cc;
for(int i=0;i<r;i++) {
for(int j=0;j<c-1;j++) {
h[i][j]=hh[i][j];
}
}
for(int i=0;i<r-1;i++) {
for(int j=0;j<c;j++) {
v[i][j]=vv[i][j];
}
}
for(int i=0;i<=(r-1)/bs;i++) {
update(i,i*bs,min(i*bs+bs,r-1));
}
tp=arr[0];
for(int i=1;i<=(r-1)/bs;i++) {
tp=merge(tp,arr[i]);
}
}
void changeH(int p,int q,int w) {
h[p][q]=w;
if (p%bs==0&&p!=0) {
update(p/bs-1,(p/bs-1)*bs,(p/bs-1)*bs+bs);
update(p/bs,p,min(p+bs,r-1));
}
else {
update(p/bs,(p/bs)*bs,min((p/bs)*bs+bs,r-1));
}
tp=arr[0];
for(int j=1;j<=(r-1)/bs;j++) {
tp=merge(tp,arr[j]);
}
}
void changeV(int p,int q,int w) {
v[p][q]=w;
update(p/bs,(p/bs)*bs,min((p/bs)*bs+bs,r-1));
tp=arr[0];
for(int j=1;j<=(r-1)/bs;j++) {
tp=merge(tp,arr[j]);
}
}
int escape(int v1,int v2) {
return tp.arr[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 |
191 ms |
8448 KB |
Output is correct |
2 |
Correct |
198 ms |
8448 KB |
Output is correct |
3 |
Correct |
267 ms |
10104 KB |
Output is correct |
4 |
Correct |
202 ms |
8448 KB |
Output is correct |
5 |
Correct |
180 ms |
8448 KB |
Output is correct |
6 |
Correct |
5 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
512 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
640 KB |
Output is correct |
5 |
Correct |
5 ms |
640 KB |
Output is correct |
6 |
Correct |
5 ms |
640 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
5 ms |
640 KB |
Output is correct |
9 |
Correct |
7 ms |
640 KB |
Output is correct |
10 |
Correct |
5 ms |
640 KB |
Output is correct |
11 |
Correct |
92 ms |
1656 KB |
Output is correct |
12 |
Correct |
5 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
905 ms |
1016 KB |
Output is correct |
2 |
Correct |
875 ms |
980 KB |
Output is correct |
3 |
Correct |
917 ms |
896 KB |
Output is correct |
4 |
Correct |
900 ms |
896 KB |
Output is correct |
5 |
Correct |
893 ms |
1016 KB |
Output is correct |
6 |
Correct |
5 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
4463 ms |
896 KB |
Output is correct |
10 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
195 ms |
16376 KB |
Output is correct |
2 |
Correct |
200 ms |
16376 KB |
Output is correct |
3 |
Correct |
207 ms |
16368 KB |
Output is correct |
4 |
Correct |
231 ms |
17144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
896 ms |
1020 KB |
Output is correct |
2 |
Correct |
878 ms |
1016 KB |
Output is correct |
3 |
Correct |
910 ms |
1016 KB |
Output is correct |
4 |
Correct |
923 ms |
1016 KB |
Output is correct |
5 |
Correct |
882 ms |
1016 KB |
Output is correct |
6 |
Correct |
198 ms |
16256 KB |
Output is correct |
7 |
Correct |
189 ms |
16376 KB |
Output is correct |
8 |
Correct |
204 ms |
16376 KB |
Output is correct |
9 |
Correct |
252 ms |
17144 KB |
Output is correct |
10 |
Correct |
187 ms |
8448 KB |
Output is correct |
11 |
Correct |
195 ms |
8552 KB |
Output is correct |
12 |
Correct |
288 ms |
10104 KB |
Output is correct |
13 |
Correct |
198 ms |
8448 KB |
Output is correct |
14 |
Correct |
181 ms |
8448 KB |
Output is correct |
15 |
Correct |
5 ms |
512 KB |
Output is correct |
16 |
Correct |
5 ms |
512 KB |
Output is correct |
17 |
Correct |
6 ms |
512 KB |
Output is correct |
18 |
Correct |
5 ms |
640 KB |
Output is correct |
19 |
Correct |
5 ms |
640 KB |
Output is correct |
20 |
Correct |
5 ms |
640 KB |
Output is correct |
21 |
Correct |
5 ms |
640 KB |
Output is correct |
22 |
Correct |
5 ms |
640 KB |
Output is correct |
23 |
Correct |
5 ms |
640 KB |
Output is correct |
24 |
Correct |
5 ms |
640 KB |
Output is correct |
25 |
Correct |
91 ms |
1656 KB |
Output is correct |
26 |
Correct |
5 ms |
640 KB |
Output is correct |
27 |
Correct |
4477 ms |
956 KB |
Output is correct |
28 |
Correct |
7626 ms |
20300 KB |
Output is correct |
29 |
Correct |
7386 ms |
16736 KB |
Output is correct |
30 |
Correct |
7433 ms |
16700 KB |
Output is correct |
31 |
Correct |
7732 ms |
21408 KB |
Output is correct |
32 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
903 ms |
1108 KB |
Output is correct |
2 |
Correct |
880 ms |
1016 KB |
Output is correct |
3 |
Correct |
903 ms |
1016 KB |
Output is correct |
4 |
Correct |
916 ms |
1016 KB |
Output is correct |
5 |
Correct |
904 ms |
1016 KB |
Output is correct |
6 |
Correct |
196 ms |
16504 KB |
Output is correct |
7 |
Correct |
212 ms |
16372 KB |
Output is correct |
8 |
Correct |
197 ms |
16376 KB |
Output is correct |
9 |
Correct |
253 ms |
17156 KB |
Output is correct |
10 |
Correct |
185 ms |
8568 KB |
Output is correct |
11 |
Correct |
200 ms |
8448 KB |
Output is correct |
12 |
Correct |
289 ms |
10084 KB |
Output is correct |
13 |
Correct |
190 ms |
8448 KB |
Output is correct |
14 |
Correct |
202 ms |
8448 KB |
Output is correct |
15 |
Correct |
2315 ms |
23180 KB |
Output is correct |
16 |
Execution timed out |
20035 ms |
24364 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |