답안 #886001

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
886001 2023-12-11T10:28:47 Z noobHeMan Tracks in the Snow (BOI13_tracks) C++17
컴파일 오류
0 ms 0 KB
 #include<bits/stdc++.h>
using namespace std;

#ifndef ONLINE_JUDGE
#include "./debug.h"
#else
#define deb(x...)
#endif

#define int         int 
#define double      double

const int INF = INT_MAX-10;
const int NINF = -INF;
const int MOD = 998244353;

int dx[4]{-1, 1, 0, 0}, dy[4]{0, 0, -1, 1};

const int maxH = 4005, maxW = 4005;
string grid[maxH];
int dist[maxH][maxW];

int H, W;
bool inside(int x, int y) {
    return x >= 0 && y >= 0 && x < H && y < W && grid[x][y] != '.'; 
}

int ans = 0;
void solve() {
    cin >> H >> W;

    for(int i=0; i<H; i++) {
        cin >> grid[i];
    }

    deque<pair<int, int>> dq;
    dq.push_back({0,0});
    dist[0][0] = 1;

    while(!dq.empty()) {
        pair<int, int> a = dq.front();
        dq.pop_front();
        
        ans = max(ans, dist[a.first][a.second]);

        for(int i=0; i<4; i++) {
            int x = a.first + dx[i], y = a.second + dy[i];
            if(inside(x, y) && dist[x][y] == 0) {
                if(grid[x][y] == grid[a.first][a.second]) {
                    dist[x][y] = dist[a.first][a.second];
                    dq.push_front({x, y});
                } else {
                    dist[x][y] = dist[a.first][a.second] + 1;
                    dq.push_back({x, y});
                }
            }
        }
    }

    cout << ans << "\n";
}

int32_t main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("error.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cout << fixed << setprecision(10);

    int t = 1;
//    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

Compilation message

tracks.cpp:5:10: fatal error: ./debug.h: No such file or directory
    5 | #include "./debug.h"
      |          ^~~~~~~~~~~
compilation terminated.