답안 #289115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289115 2020-09-02T11:17:07 Z egekabas 웜뱃 (IOI13_wombats) C++14
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
int r, c;
const int sq = 700;
int h[5000][200];
int v[5000][200];
int dis[5000/sq+5][200][200];
void dijkstra1(int beg, int end, int imp, int dis[200]){
    for(int j = 0; j < c; ++j)
        dis[j] = 1e9+7;
    dis[imp] = 0;
    for(int i = end; i >= beg; --i){
        for(int j = 1; j < c; ++j)
            dis[j] = min(dis[j], dis[j-1]+h[i][j-1]);
        for(int j = c-2; j >= 0; --j)
            dis[j] = min(dis[j], dis[j+1]+h[i][j]);
        for(int j = 0; j < c && i != beg; ++j)
            dis[j] = min((int)1e9+7, dis[j] + v[i-1][j]);
    }
}
int segdis[200][5000/sq+5][200];
int cnt;
void dijkstra2(int start, int d[5000/sq+5][200]){
    for(int i = 0; i < r; i += sq){
        for(int j = 0; j < c; ++j)
            d[i/sq][j] = d[i/sq+1][j] = 1e9+7;
        cnt = max(cnt, i/sq+1);
    }
    d[0][start] = 0;
    for(int i = 0; i < r; i += sq)
        for(int j = 0; j < c; ++j)
            for(int k = 0; k < c; ++k){
                d[i/sq+1][k] = min(d[i/sq+1][k], d[i/sq][j] + dis[i/sq][k][j]);
            }
}


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; ++j){
            h[i][j] = H[i][j];
            v[i][j] = V[i][j];
        }
    for(int i = 0; i < r; i += sq)
        for(int j = 0; j < c; ++j)
            dijkstra1(i, min(i+sq, r-1), j, dis[i/sq][j]);
    for(int j = 0; j < c; ++j)
        dijkstra2(j,  segdis[j]);
}
vector<int> change;
void changeH(int P, int Q, int W) {
    h[P][Q] = W;
    int gr = P/sq;
    change.pb(gr);
    if(gr > 0 && P%sq == 0){
        change.pb(gr-1);
    }
}
    
void changeV(int P, int Q, int W) {
    v[P][Q] = W;
    int gr = P/sq;
    change.pb(gr);
}
int curd[200];
int newd[200];
int done[sq+5];
int escape(int V1, int V2) {
    for(auto u : change){
        if(done[u]) continue;
        for(int j = 0; j < c; ++j)
            dijkstra1(u*sq, min(r-1, (u+1)*sq), j, dis[u][j]);
    }
    if(change.size())
        for(int j = 0; j < c; ++j)
            dijkstra2(j, segdis[j]);
    for(auto u : change)
        done[u] = 0;
    change.clear();
    return segdis[V1][cnt][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;
      |      ^~~
wombats.cpp:1:10: fatal error: grader.h: No such file or directory
    1 | #include "grader.h"
      |          ^~~~~~~~~~
compilation terminated.