제출 #856951

#제출 시각아이디문제언어결과실행 시간메모리
856951teeslaTracks in the Snow (BOI13_tracks)C++14
84.69 / 100
2106 ms148136 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 4005; typedef pair<int,int> ii; typedef pair<int, ii> iii; int adj[maxn][maxn], vis[maxn][maxn]; int vx[4] = {0,1,0,-1}, vy[4] = {1,0,-1,0}; int h,w; int dijkstra(){ priority_queue<iii, vector<iii> , greater<iii>> q; vis[h][w] = 1; q.push({1,{h,w}}); int maior = 1; while(!q.empty()){ auto [a,b] = q.top(); auto [x,y] = b; q.pop(); if(vis[x][y] < a) continue; maior = max(maior, a); for(int i=0; i<4; i++){ int xx = x + vx[i], yy = y + vy[i]; if(adj[xx][yy] == 0) continue; int val = a; if(adj[x][y] != adj[xx][yy]) val += 1; if(vis[xx][yy] != 0 and vis[xx][yy] <= val) continue; vis[xx][yy] = val; q.push({val, {xx,yy}}); } } return maior; } int main(){ cin >> h >> w; for(int i=1; i<=h; i++){ string s; cin >> s; for(int j =0; j<w; j++){ int val = 0; if(s[j] == 'R') val = 1; else if(s[j] == 'F') val = 2; adj[i][j+1] = val; } } cout << dijkstra() << endl; return 0; }

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

tracks.cpp: In function 'int dijkstra()':
tracks.cpp:22:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   22 |         auto [a,b] = q.top();
      |              ^
tracks.cpp:23:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   23 |         auto [x,y] = b;
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...