제출 #1091825

#제출 시각아이디문제언어결과실행 시간메모리
1091825Jakub_WozniakTracks in the Snow (BOI13_tracks)C++14
84.69 / 100
2102 ms80056 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 4009; typedef long long ll; int N , M; string s[maxn]; int a , b , c; vector <pair<int,int>> R; bool vis[maxn][maxn]; int MAXI = 0; void pr() { R.push_back({-1,0}); R.push_back({1,0}); R.push_back({0,1}); R.push_back({0,-1}); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> M; for(int i = 0 ; i <= M+1 ; i++ )s[0] += '.'; for(int i = 0 ; i <= M+1 ; i++ )s[N+1] += '.'; pr(); for(int i = 1 ; i <= N ;i++) { cin >> s[i]; s[i] = '.'+s[i]+'.'; } priority_queue <pair<int,int>> q; pair<int,int> DS; q.push({-1,1*maxn+1}); int i , j; while(!q.empty()) { DS = q.top(); c = -DS.first; i = DS.second/maxn; j = DS.second%maxn; q.pop(); if(vis[i][j] == 1){continue;} vis[i][j] = 1; MAXI = max(MAXI , c); for(int k = 0 ; k < R.size() ; k++) { a = i+R[k].first; b = j+R[k].second; if(s[a][b] == '.' || vis[a][b] == 1)continue; if(s[a][b] == s[i][j]){ q.push({-c,a*maxn+b});} else {q.push({-(c+1),a*maxn+b});} } } cout << MAXI << '\n'; return 0; }

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

tracks.cpp: In function 'int main()':
tracks.cpp:51:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         for(int k = 0 ; k < R.size() ; k++)
      |                         ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...