답안 #575783

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
575783 2022-06-11T09:13:55 Z Belgutei 웜뱃 (IOI13_wombats) C++17
37 / 100
20000 ms 16948 KB
#include "wombats.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define X real()
#define Y imag()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define MOD 1000000007
#define MOD1 1000000009
#define sqr(x) sqr((x)*(x))

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
#ifdef BE_DEBUG
#define debug(...) cerr << "\033[1;31m(" << #__VA_ARGS__ << "):\033[0m", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

int h[5000][200];
int v[5000][200];
priority_queue<pair<int,pair<int,int> > > pq;
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 < 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) {
    
    while(pq.size() > 0) pq.pop();
    pq.push({0,{0,V1}});
    bool visited[r][c];
    memset(visited,0,sizeof(visited));
    while(pq.size() > 0) {
        pair<int,pair<int,int> > p;
        //cout << p.ff << ' ' << p.ss.ff << ' ' << p.ss.ss << '\n';
        p = pq.top();
        pq.pop();
        if(visited[p.ss.ff][p.ss.ss] == 1) continue;
        visited[p.ss.ff][p.ss.ss] = 1;
        if(p.ss.ff == r - 1 && p.ss.ss == V2) return -p.ff;
        if(p.ss.ss > 0 && visited[p.ss.ff][p.ss.ss - 1] == 0) {
            pq.push({p.ff - h[p.ss.ff][p.ss.ss - 1],{p.ss.ff, p.ss.ss - 1}});
        }
        if(p.ss.ss + 1 < c && visited[p.ss.ff][p.ss.ss + 1] == 0) {
            pq.push({p.ff - h[p.ss.ff][p.ss.ss],{p.ss.ff,p.ss.ss + 1}});
        }
        if(p.ss.ff + 1 < r && visited[p.ss.ff + 1][p.ss.ss] == 0) {
            pq.push({p.ff - v[p.ss.ff][p.ss.ss],{p.ss.ff + 1, p.ss.ss}});
        }
    }
    return 42;
}

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 47 ms 8116 KB Output is correct
2 Correct 49 ms 8020 KB Output is correct
3 Correct 17080 ms 9880 KB Output is correct
4 Correct 49 ms 8020 KB Output is correct
5 Correct 47 ms 8124 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 16 ms 396 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 19 ms 316 KB Output is correct
7 Correct 21 ms 388 KB Output is correct
8 Correct 17 ms 320 KB Output is correct
9 Correct 19 ms 396 KB Output is correct
10 Correct 17 ms 340 KB Output is correct
11 Correct 9062 ms 1932 KB Output is correct
12 Correct 20 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 179 ms 724 KB Output is correct
2 Correct 186 ms 868 KB Output is correct
3 Correct 175 ms 724 KB Output is correct
4 Correct 163 ms 724 KB Output is correct
5 Correct 167 ms 724 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 200 ms 824 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 617 ms 16016 KB Output is correct
2 Correct 1242 ms 16008 KB Output is correct
3 Correct 610 ms 16020 KB Output is correct
4 Execution timed out 20030 ms 16668 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 160 ms 724 KB Output is correct
2 Correct 181 ms 868 KB Output is correct
3 Correct 169 ms 728 KB Output is correct
4 Correct 165 ms 724 KB Output is correct
5 Correct 160 ms 724 KB Output is correct
6 Correct 571 ms 16016 KB Output is correct
7 Correct 1042 ms 16004 KB Output is correct
8 Correct 554 ms 16144 KB Output is correct
9 Execution timed out 20092 ms 16948 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 164 ms 724 KB Output is correct
2 Correct 180 ms 868 KB Output is correct
3 Correct 176 ms 716 KB Output is correct
4 Correct 170 ms 724 KB Output is correct
5 Correct 162 ms 724 KB Output is correct
6 Correct 546 ms 16032 KB Output is correct
7 Correct 1049 ms 16008 KB Output is correct
8 Correct 553 ms 16144 KB Output is correct
9 Execution timed out 20081 ms 16608 KB Time limit exceeded
10 Halted 0 ms 0 KB -