Submission #962302

# Submission time Handle Problem Language Result Execution time Memory
962302 2024-04-13T10:18:26 Z Ice_man Wombats (IOI13_wombats) C++17
Compilation error
0 ms 0 KB
/**
 ____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

#include"wombats.h"
#include <iostream>

#define maxn 5005
#define maxn2 205


using namespace std;

int c, r;
int h[maxn][maxn2];
int v[maxn][maxn2];




int dp[5001][100][5001];



void calc_row(int i, int j)
{
    for(int k = 1; k < c; k++)
        dp[i][j][k] = min(dp[i][j][k], dp[i][j][k - 1] + h[j][k - 1]);
    for(int k = c - 2; k > -1; k--)
        dp[i][j][k] = min(dp[i][j][k], dp[i][j][k + 1] + h[i][k]);
}



void calc_dp(int i)
{
    for(int j = 0; j < r; j++)
        for(int k = 0; k < c; k++)
            dp[i][j][k] = 1e9;
    dp[i][0][i] = 0;

    calc_row(i, 0);


    for(int j = 1; j < r; j++)
    {
        for(int k = 0; k < c; k++)
            dp[i][j][k] = dp[i][j - 1][k] + v[j - 1][k];
        calc_row(i, j);
    }
}



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


    for(int i = 0; i < r; i++)
        for(int j = 0; j < c; j++)
        {
            if(i + 1 < r)
                v[i][j] = V[i][j];
            if(j + 1 < c)
                h[i][j] = H[i][j];
        }

    for(int i = 0; i < c; i++)
        calc_dp(i);
}



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


void changeV(int P , int Q , int W)
{
    v[P][Q] = W;
    for(int i = 0; i < c; i++)
        calc_dp(i);
}


int escape(int V1 , int V2)
{
    return dp[V1][r - 1][V2];
}

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;
      |      ^~~
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status