답안 #1022250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1022250 2024-07-13T11:38:36 Z amine_aroua 웜뱃 (IOI13_wombats) C++17
25 / 100
20000 ms 262144 KB
#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> h , v;
int r , c;
int xx[3] = {1 , 0 , 0};
int yy[3] = {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}});
    bitset<5000> vis[c];
    while(!pq.empty())
    {
        auto [d , p] = pq.top();
        auto [i , j] = p;
        pq.pop();
        vis[j][i] = 1;
        if(i == r - 1 && j == V2)
        {
            return d;
        }
        for(int k = 0 ; k < 3 ; 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(yy[k] == 1)
                    cost = h[i][j];
                if(yy[k] == -1)
                    cost = h[i][j - 1];
                if(!vis[nj][ni])
                {
                    pq.push({cost + d , {ni , nj}});
                }
            }
        }
    }
}

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;
      |      ^~~
wombats.cpp: In function 'int escape(int, int)':
wombats.cpp:37:117: warning: control reaches end of non-void function [-Wreturn-type]
   37 |     priority_queue<pair<int ,pair<int ,int>> ,vector<pair<int ,pair<int,int>>>, greater<pair<int ,pair<int, int>>>> pq;
      |                                                                                                                     ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 4696 KB Output is correct
2 Correct 33 ms 4696 KB Output is correct
3 Correct 12533 ms 7564 KB Output is correct
4 Correct 35 ms 4700 KB Output is correct
5 Correct 33 ms 4700 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 80 ms 348 KB Output is correct
5 Runtime error 2890 ms 262144 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 1108 KB Output is correct
2 Correct 147 ms 1328 KB Output is correct
3 Correct 433 ms 856 KB Output is correct
4 Correct 368 ms 1108 KB Output is correct
5 Correct 360 ms 860 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 448 KB Output is correct
9 Correct 1678 ms 3640 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12129 ms 9140 KB Output is correct
2 Execution timed out 20040 ms 11372 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 478 ms 892 KB Output is correct
2 Correct 152 ms 1328 KB Output is correct
3 Correct 433 ms 872 KB Output is correct
4 Correct 387 ms 856 KB Output is correct
5 Correct 363 ms 860 KB Output is correct
6 Correct 11899 ms 9008 KB Output is correct
7 Execution timed out 20053 ms 11592 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 486 ms 856 KB Output is correct
2 Correct 149 ms 1436 KB Output is correct
3 Correct 442 ms 1104 KB Output is correct
4 Correct 363 ms 860 KB Output is correct
5 Correct 363 ms 868 KB Output is correct
6 Correct 11982 ms 9048 KB Output is correct
7 Execution timed out 20042 ms 11372 KB Time limit exceeded
8 Halted 0 ms 0 KB -