제출 #1120701

#제출 시각아이디문제언어결과실행 시간메모리
1120701vjudge1Tracks in the Snow (BOI13_tracks)C++14
84.69 / 100
2095 ms114476 KiB
#include"bits/stdc++.h" using namespace std; const short mxN = 4001; int cl[mxN][mxN]; short g[mxN][mxN]; short H, W; bool legal(short i, short j) { return 0 <= i && 0 <= j && i < H && j < W && 2 != g[i][j]; } int main() { cin.tie(nullptr)->sync_with_stdio(false); cin >> H >> W; for (int i = 0; i < H; i ++) { for (int j = 0; j < W; j ++) { char c; cin >> c; if ('F' == c) { g[i][j] = 1; } else if ('.' == c) { g[i][j] = 2; } } } priority_queue<array<int,3>> pq; pq.push({-1, 0, 0}); cl[0][0] = -1; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int ans = 0; while (!pq.empty()) { auto [c, i, j] = pq.top(); ans = c; pq.pop(); for (int k = 0; k < 4; k ++) { short l = i + dx[k]; short o = j + dy[k]; if (legal(l, o) && 0 == cl[l][o]) { if (g[l][o] == g[i][j]) { cl[l][o] = c; pq.push({c, l, o}); } else { cl[l][o] = c - 1; pq.push({c - 1, l, o}); } } } } cout << -ans << endl; }

컴파일 시 표준 에러 (stderr) 메시지

tracks.cpp: In function 'int main()':
tracks.cpp:39:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   39 |         auto [c, i, j] = pq.top();
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...