답안 #728389

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
728389 2023-04-22T10:26:13 Z Rasoul006 웜뱃 (IOI13_wombats) C++17
0 / 100
11 ms 24276 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 cost[N] , a[N][2] ;

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

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

    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] ;
            cost[i] = h[i][j] ;
            a[i][j] = v[i][j] ;
        }
    }

}

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

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

ll dp[N][2][2] ;

ll bt (ll i , bool is , bool is2)
{
    if (i == n)
    {
        if (is == is2)
            return 0 ;
        else
            return oo ;
    }

    ll &ret = dp[i][is][is2] ;

    if (~ret)
        return ret ;

    ret = bt(i+1 , is , is2) + a[i][is] ;

    ret = min (ret , bt(i+1 , !is , is2) + a[i][!is] + cost[i]) ;

    return ret ;
}

int escape(int V1, int V2)
{
    return bt(0 , 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]
   15 |  int res;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 20308 KB Output is correct
2 Incorrect 10 ms 20308 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 24276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -