Submission #76628

# Submission time Handle Problem Language Result Execution time Memory
76628 2018-09-15T09:34:02 Z Bodo171 Wombats (IOI13_wombats) C++14
55 / 100
20000 ms 53400 KB
#include "wombats.h"
#include <iostream>
using namespace std;
int h[5005][205],v[5005][205],d[5005][205];
int c[205][205];
int cc[205];
int i,j,n,m;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
    n=R;m=C;
    for(i=0;i<n;i++)
        for(j=0;j<m;j++)
           h[i][j]=H[i][j],v[i][j]=V[i][j];
}

void changeH(int P, int Q, int W) {
    h[P][Q]=W;
    for(i=0;i<m;i++)
        cc[i]=0;
}

void changeV(int P, int Q, int W) {
   v[P][Q]=W;
   for(i=0;i<m;i++)
        cc[i]=0;
}
void calc(int source)
{
    cc[source]=1;
    for(i=0;i<n;i++)
        for(j=0;j<m;j++)
           d[i][j]=(1<<30);
    d[0][source]=0;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            if(i) d[i][j]=min(d[i][j],d[i-1][j]+v[i-1][j]);
            if(j) d[i][j]=min(d[i][j],d[i][j-1]+h[i][j-1]);
        }
        for(j=m-1;j>=0;j--)
        {
            if(j<m-1) d[i][j]=min(d[i][j],d[i][j+1]+h[i][j]);
        }
    }
    for(i=0;i<m;i++)
        c[source][i]=d[n-1][i];
}
int escape(int V1, int V2) {
    if(!cc[V1])
        calc(V1);
    return c[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 52 ms 16504 KB Output is correct
2 Correct 52 ms 16528 KB Output is correct
3 Correct 131 ms 19284 KB Output is correct
4 Correct 55 ms 19284 KB Output is correct
5 Correct 53 ms 19284 KB Output is correct
6 Correct 2 ms 19284 KB Output is correct
7 Correct 2 ms 19284 KB Output is correct
8 Correct 2 ms 19284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 19284 KB Output is correct
2 Correct 2 ms 19284 KB Output is correct
3 Correct 2 ms 19284 KB Output is correct
4 Correct 2 ms 19284 KB Output is correct
5 Correct 2 ms 19284 KB Output is correct
6 Correct 2 ms 19284 KB Output is correct
7 Correct 2 ms 19284 KB Output is correct
8 Correct 2 ms 19284 KB Output is correct
9 Correct 2 ms 19284 KB Output is correct
10 Correct 2 ms 19284 KB Output is correct
11 Correct 87 ms 19284 KB Output is correct
12 Correct 3 ms 19284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 19284 KB Output is correct
2 Correct 16 ms 19284 KB Output is correct
3 Correct 13 ms 19284 KB Output is correct
4 Correct 13 ms 19284 KB Output is correct
5 Correct 13 ms 19284 KB Output is correct
6 Correct 2 ms 19284 KB Output is correct
7 Correct 2 ms 19284 KB Output is correct
8 Correct 2 ms 19284 KB Output is correct
9 Correct 9 ms 19284 KB Output is correct
10 Correct 2 ms 19284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 23884 KB Output is correct
2 Correct 137 ms 23956 KB Output is correct
3 Correct 139 ms 24012 KB Output is correct
4 Correct 186 ms 25580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 25580 KB Output is correct
2 Correct 12 ms 25580 KB Output is correct
3 Correct 13 ms 25580 KB Output is correct
4 Correct 13 ms 25580 KB Output is correct
5 Correct 13 ms 25580 KB Output is correct
6 Correct 137 ms 25580 KB Output is correct
7 Correct 134 ms 25580 KB Output is correct
8 Correct 132 ms 25580 KB Output is correct
9 Correct 191 ms 26776 KB Output is correct
10 Correct 54 ms 26776 KB Output is correct
11 Correct 51 ms 26776 KB Output is correct
12 Correct 124 ms 26776 KB Output is correct
13 Correct 50 ms 26776 KB Output is correct
14 Correct 49 ms 26776 KB Output is correct
15 Correct 2 ms 26776 KB Output is correct
16 Correct 2 ms 26776 KB Output is correct
17 Correct 2 ms 26776 KB Output is correct
18 Correct 3 ms 26776 KB Output is correct
19 Correct 3 ms 26776 KB Output is correct
20 Correct 3 ms 26776 KB Output is correct
21 Correct 3 ms 26776 KB Output is correct
22 Correct 2 ms 26776 KB Output is correct
23 Correct 2 ms 26776 KB Output is correct
24 Correct 3 ms 26776 KB Output is correct
25 Correct 149 ms 26776 KB Output is correct
26 Correct 3 ms 26776 KB Output is correct
27 Correct 9 ms 26776 KB Output is correct
28 Execution timed out 20068 ms 32852 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 32852 KB Output is correct
2 Correct 13 ms 32852 KB Output is correct
3 Correct 13 ms 32852 KB Output is correct
4 Correct 13 ms 32852 KB Output is correct
5 Correct 13 ms 32852 KB Output is correct
6 Correct 139 ms 33184 KB Output is correct
7 Correct 141 ms 33288 KB Output is correct
8 Correct 137 ms 33416 KB Output is correct
9 Correct 191 ms 34736 KB Output is correct
10 Correct 48 ms 34736 KB Output is correct
11 Correct 49 ms 34736 KB Output is correct
12 Correct 127 ms 34736 KB Output is correct
13 Correct 48 ms 34736 KB Output is correct
14 Correct 46 ms 34736 KB Output is correct
15 Correct 298 ms 45260 KB Output is correct
16 Execution timed out 20022 ms 53400 KB Time limit exceeded
17 Halted 0 ms 0 KB -