답안 #1022214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1022214 2024-07-13T11:10:29 Z amine_aroua 웜뱃 (IOI13_wombats) C++17
28 / 100
20000 ms 10020 KB
#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> h , v;
int r , c;
int xx[4] = {1 , 0 , 0};
int yy[4] = {0 , -1 , 1};
void init(int R, int C, int H[5000][200], int V[5000][200]) {
    r = R;
    c = C;
    h.assign(R , vector<int>(C));
    v = h;
    for(int i = 0 ; i < R ; i++)
    {
        for(int j = 0;  j < C - 1 ; j++)
        {
            h[i][j] = H[i][j];
        }
    }
    for(int i = 0 ; i < R-1 ; i++)
    {
        for(int j = 0;  j < C ; 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>> ,vector<pair<int ,pair<int,int>>>, greater<pair<int ,pair<int, int>>>> pq;
    pq.push({0 , {0 , V1}});
    vector<bitset<200>> vis(r);
    vector<vector<int>> dist(r , vector<int>(c , 2e9));
    dist[0][V1] = 0;
    while(!pq.empty())
    {
        auto [d , p] = pq.top();
        auto [i , j] = p;
        pq.pop();
        if(vis[i][j])
            continue;
        vis[i][j] = 1;
        for(int k = 0 ; k < 4 ; k++)
        {
            int ni = i + xx[k] , nj = j + yy[k];
            if(ni >= 0 && nj >= 0 && ni < r && nj < c)
            {
                int cost = 0;
                if(xx[k] == 1)
                    cost = v[i][j];
                if(xx[k] == -1)
                    cost = v[i - 1][j];
                if(yy[k] == 1)
                    cost = h[i][j];
                if(yy[k] == -1)
                    cost = h[i][j - 1];
                if(dist[ni][nj] > dist[i][j] + cost)
                {
                    dist[ni][nj] = dist[i][j] + cost;
                    pq.push({dist[ni][nj] , {ni , nj}});
                }
            }
        }
    }
    return dist[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 133 ms 5364 KB Output is correct
2 Correct 134 ms 5372 KB Output is correct
3 Execution timed out 20063 ms 7288 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 16 ms 500 KB Output is correct
5 Correct 7 ms 348 KB Output is correct
6 Correct 8 ms 496 KB Output is correct
7 Correct 12 ms 508 KB Output is correct
8 Correct 11 ms 344 KB Output is correct
9 Correct 12 ms 500 KB Output is correct
10 Correct 14 ms 344 KB Output is correct
11 Correct 6265 ms 2732 KB Output is correct
12 Correct 13 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 600 KB Output is correct
2 Correct 171 ms 976 KB Output is correct
3 Correct 104 ms 604 KB Output is correct
4 Correct 103 ms 808 KB Output is correct
5 Correct 103 ms 600 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 156 ms 836 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 504 ms 9384 KB Output is correct
2 Correct 988 ms 9304 KB Output is correct
3 Correct 516 ms 9304 KB Output is correct
4 Execution timed out 20041 ms 10020 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 600 KB Output is correct
2 Correct 172 ms 972 KB Output is correct
3 Correct 108 ms 816 KB Output is correct
4 Correct 106 ms 600 KB Output is correct
5 Correct 104 ms 604 KB Output is correct
6 Correct 483 ms 9308 KB Output is correct
7 Correct 1043 ms 9560 KB Output is correct
8 Correct 511 ms 9304 KB Output is correct
9 Execution timed out 20035 ms 9988 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 604 KB Output is correct
2 Correct 171 ms 972 KB Output is correct
3 Correct 109 ms 600 KB Output is correct
4 Correct 104 ms 604 KB Output is correct
5 Correct 103 ms 604 KB Output is correct
6 Correct 480 ms 9308 KB Output is correct
7 Correct 1040 ms 9304 KB Output is correct
8 Correct 479 ms 9304 KB Output is correct
9 Execution timed out 20050 ms 10008 KB Time limit exceeded
10 Halted 0 ms 0 KB -