답안 #1074048

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074048 2024-08-25T07:16:57 Z mindiyak 웜뱃 (IOI13_wombats) C++17
16 / 100
20000 ms 24632 KB
#include "wombats.h"
#include <vector>
#include <iostream>
#include <queue>

typedef long long ll;
#define F first
#define S second

using namespace std;

int H[5000][200];
int V[5000][200];
int R,C; 

void init(int r, int c, int h[5000][200], int v[5000][200]) {
    R = r;
    C = c;
    for(int i=0;i<5000;i++)for(int j=0;j<200;j++)H[i][j] = h[i][j];
    for(int i=0;i<5000;i++)for(int j=0;j<200;j++)V[i][j] = v[i][j];
}

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) {
    priority_queue<pair<int,pair<int,int>>> pq;

    pq.push({0,{0,V1}});
    int dis[5005][205];
    int vis[5005][205];

    for(int i=0;i<5005;i++)for(int j=0;j<205;j++)dis[i][j] = 2e9;
    for(int i=0;i<5005;i++)for(int j=0;j<205;j++)vis[i][j] = 0;

    dis[0][V1] = 0;

    while(!pq.empty()){
        int y = pq.top().S.F;
        int x = pq.top().S.S;
        pq.pop();

        if(vis[y][x])continue;
        vis[y][x] = 1;

        if(x > 0 && (dis[y][x] + H[y][x-1] < dis[y][x-1])){
            // cerr << x << "," << y << " " << dis[y][x] << " " << H[y][x-1] << " L\n";
            dis[y][x-1] = dis[y][x] + H[y][x-1];
            pq.push({-dis[y][x-1],{y,x-1}});
        }

        if(x < (C-1) && (dis[y][x] + H[y][x] < dis[y][x+1])){
            // cerr << x << "," << y << " " << dis[y][x] << " " << H[y][x] << " R\n";
            dis[y][x+1] = dis[y][x] + H[y][x];
            pq.push({-dis[y][x+1],{y,x+1}});
        }

        if(y < (R-1) && (dis[y][x] + V[y][x] < dis[y+1][x])){
            // cerr << x << "," << y << " " << dis[y][x] << " " << V[y][x] << " D\n";
            dis[y+1][x] = dis[y][x] + V[y][x];
            pq.push({-dis[y+1][x],{y+1,x}});
        }
    }

    // for(int i=0;i<R;i++){
    //     for(int j=0;j<C;j++){
    //         cerr << dis[i][j] << " ";
    //     }cerr << endl;
    // }cerr << endl;

    return dis[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;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 286 ms 21852 KB Output is correct
2 Correct 283 ms 21852 KB Output is correct
3 Execution timed out 20053 ms 22544 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 17756 KB Output is correct
2 Correct 7 ms 17756 KB Output is correct
3 Correct 7 ms 17756 KB Output is correct
4 Correct 215 ms 19856 KB Output is correct
5 Correct 210 ms 19800 KB Output is correct
6 Correct 203 ms 19800 KB Output is correct
7 Correct 228 ms 19804 KB Output is correct
8 Correct 197 ms 19804 KB Output is correct
9 Correct 208 ms 19804 KB Output is correct
10 Correct 189 ms 19848 KB Output is correct
11 Execution timed out 20026 ms 20368 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 19800 KB Output is correct
2 Correct 209 ms 20156 KB Output is correct
3 Correct 152 ms 19996 KB Output is correct
4 Correct 160 ms 19912 KB Output is correct
5 Correct 150 ms 19804 KB Output is correct
6 Correct 11 ms 17752 KB Output is correct
7 Correct 7 ms 17756 KB Output is correct
8 Correct 7 ms 17756 KB Output is correct
9 Correct 213 ms 19804 KB Output is correct
10 Correct 8 ms 19804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 820 ms 24152 KB Output is correct
2 Correct 1313 ms 24152 KB Output is correct
3 Correct 853 ms 24156 KB Output is correct
4 Execution timed out 20048 ms 24616 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 152 ms 19800 KB Output is correct
2 Correct 208 ms 20140 KB Output is correct
3 Correct 150 ms 19804 KB Output is correct
4 Correct 152 ms 19940 KB Output is correct
5 Correct 156 ms 19804 KB Output is correct
6 Correct 809 ms 24400 KB Output is correct
7 Correct 1318 ms 24156 KB Output is correct
8 Correct 841 ms 24172 KB Output is correct
9 Execution timed out 20016 ms 24632 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 152 ms 19804 KB Output is correct
2 Correct 206 ms 20124 KB Output is correct
3 Correct 151 ms 19800 KB Output is correct
4 Correct 158 ms 19800 KB Output is correct
5 Correct 151 ms 20056 KB Output is correct
6 Correct 875 ms 24152 KB Output is correct
7 Correct 1316 ms 24088 KB Output is correct
8 Correct 889 ms 24168 KB Output is correct
9 Execution timed out 20062 ms 24588 KB Time limit exceeded
10 Halted 0 ms 0 KB -