Submission #728358

# Submission time Handle Problem Language Result Execution time Memory
728358 2023-04-22T09:57:46 Z Rasoul006 Wombats (IOI13_wombats) C++17
12 / 100
74 ms 24936 KB
#include "wombats.h"

#include <bits/stdc++.h>

#define endl "\n"

#define F first

#define S second

#define pb push_back

#define all(x) x.begin() , x.end()

typedef long long ll;

using namespace std;

const int N = 6e3+5;

const long long oo = 1e18;

ll dx[] = {1 , -1 , 0} ;
ll dy[] = {0 , 0 , 1} ;

ll n , m , h[N][204] , v[N][204] , sum , c , r ;

ll dis[24][24][24][24] ;

set < pair <ll, pair <ll, ll>> > st ;

void init(int R, int C, int H[5000][200], int V[5000][200]) {

    r = R , c = C ;

    n = r , m = c ;

    for (int i = 0 ; i<n ; i++)
    {
        for (int j = 0 ; j<m ; j++)
            v[i][j] = V[i][j] , h[i][j] = H[i][j] ;
    }

    for (int i = 0 ; i<m ; i++)
    {
        for (int p = 0 ; p<n ; p++)
            for (int j = 0 ; j<m ; j++)
                dis[0][i][p][j] = oo ;

        st.insert({0 , {0 , i}});

        while (!st.empty())
        {
            pair <ll , pair <ll,ll>> pr = *st.begin() ;

            st.erase(st.begin());

            ll cos = pr.F , x = pr.S.F , y = pr.S.S ;

            if (cos + v[x][y] < dis[0][i][x+1][y] && x+1 < n)
            {
                dis[0][i][x+1][y] = cos + v[x][y] ;
                st.insert({dis[0][i][x+1][y] , {x+1 , y}});
            }

            if (cos + h[x][y] < dis[0][i][x][y+1] && y+1<m)
            {
                dis[0][i][x][y+1] = cos + h[x][y] ;
                st.insert({dis[0][i][x][y+1] , {x , y+1}});
            }

            if (cos + h[x][y-1] < dis[0][i][x][y-1] && y-1 >= 0)
            {
                dis[0][i][x][y-1] = cos + h[x][y-1] ;
                st.insert({dis[0][i][x][y-1] , {x , y-1}});
            }
        }
    }

}

void changeH(int P, int Q, int W) {
    h[P][Q] = W ;
}

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

int escape(int V1, int V2){

    return dis[0][V1][n-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;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 21076 KB Output is correct
2 Incorrect 9 ms 21076 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Correct 2 ms 456 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 74 ms 2856 KB Output is correct
12 Correct 2 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1172 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 24936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1228 KB Output isn't correct
2 Halted 0 ms 0 KB -