Submission #420029

# Submission time Handle Problem Language Result Execution time Memory
420029 2021-06-08T00:33:32 Z Ozy Wombats (IOI13_wombats) C++17
28 / 100
20000 ms 36864 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl

struct x{
    lli f;
    lli c;
    lli val;

    bool operator < (const x &a)
    const {
        return val > a.val;
    }
};

x act;
lli hijos[5002][202][3],visitados[5002][202];
lli fil,col;
priority_queue<x> cola;

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    fil = R;
    col = C;

    rep(i,0,R-1) {
        rep(j,0,C-2) {
            hijos[i][j][2] = H[i][j];
            hijos[i][j+1][0] = H[i][j];
        }
    }

    rep(i,0,R-2) {
        rep(j,0,C-1) hijos[i][j][1] = V[i][j];
    }
}

void changeH(int P, int Q, int W) {
    hijos[P][Q][2] = W;
    hijos[P][Q+1][0] = W;
}

void changeV(int P, int Q, int W) {
    hijos[P][Q][1] = W;
}

int escape(int V1, int V2) {

    rep(i,0,fil-1) rep(j,0,col-1) visitados[i][j] = 0;
    while (!cola.empty()) cola.pop();

    cola.push({0,V1,0});
    while (!cola.empty()) {

        act = cola.top();
        cola.pop();

        if (visitados[act.f][act.c] == 0) visitados[act.f][act.c] = 1;
        else continue;

        if (act.f == fil-1 && act.c == V2) return act.val;

        if (act.c > 0 && visitados[act.f][act.c-1] == 0) cola.push({act.f,(act.c-1),(act.val + hijos[act.f][act.c][0])});

        if (act.c < (col-1) && visitados[act.f][act.c+1] == 0) cola.push({act.f,(act.c+1),(act.val + hijos[act.f][act.c][2])});

        if (act.f < (fil-1) && visitados[act.f+1][act.c] == 0) cola.push({(act.f+1),act.c,(act.val + hijos[act.f][act.c][1])});

    }
}

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;
      |      ^~~
wombats.cpp: In function 'int escape(int, int)':
wombats.cpp:74:1: warning: control reaches end of non-void function [-Wreturn-type]
   74 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 130 ms 32064 KB Output is correct
2 Correct 130 ms 32140 KB Output is correct
3 Execution timed out 20033 ms 33456 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 236 KB Output is correct
4 Correct 15 ms 472 KB Output is correct
5 Correct 7 ms 432 KB Output is correct
6 Correct 16 ms 460 KB Output is correct
7 Correct 22 ms 460 KB Output is correct
8 Correct 16 ms 460 KB Output is correct
9 Correct 20 ms 480 KB Output is correct
10 Correct 19 ms 480 KB Output is correct
11 Correct 9397 ms 2732 KB Output is correct
12 Correct 21 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 1100 KB Output is correct
2 Correct 163 ms 1420 KB Output is correct
3 Correct 170 ms 1184 KB Output is correct
4 Correct 165 ms 1188 KB Output is correct
5 Correct 165 ms 1188 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 208 ms 1256 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 796 ms 36236 KB Output is correct
2 Correct 1477 ms 36300 KB Output is correct
3 Correct 824 ms 36300 KB Output is correct
4 Execution timed out 20054 ms 36864 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 175 ms 1108 KB Output is correct
2 Correct 170 ms 1468 KB Output is correct
3 Correct 165 ms 1100 KB Output is correct
4 Correct 164 ms 1188 KB Output is correct
5 Correct 163 ms 1224 KB Output is correct
6 Correct 777 ms 36292 KB Output is correct
7 Correct 1452 ms 36400 KB Output is correct
8 Correct 783 ms 36280 KB Output is correct
9 Execution timed out 20023 ms 36756 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 162 ms 1100 KB Output is correct
2 Correct 163 ms 1420 KB Output is correct
3 Correct 169 ms 1100 KB Output is correct
4 Correct 166 ms 1100 KB Output is correct
5 Correct 166 ms 1100 KB Output is correct
6 Correct 788 ms 36300 KB Output is correct
7 Correct 1464 ms 36300 KB Output is correct
8 Correct 828 ms 36272 KB Output is correct
9 Execution timed out 20068 ms 36712 KB Time limit exceeded
10 Halted 0 ms 0 KB -