제출 #1255320

#제출 시각아이디문제언어결과실행 시간메모리
1255320Mer123haba456Tracks in the Snow (BOI13_tracks)C++20
100 / 100
1970 ms303284 KiB
#include <bits/stdc++.h> using namespace std; #define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define N lli(4005) #define MOD lli(1e9 + 7) #define heps(v) v.begin(), v.end() typedef long long int lli; typedef vector<lli> vlli; typedef pair<lli, lli> plli; typedef vector<plli> vplli; typedef pair<lli, plli> pplli; typedef vector<pplli> vpplli; lli n,m,k,q,t; vlli vect; lli diz[N][N]; lli vis[4002][4002]; vplli yonler = {{0,1},{0,-1}, {1,0}, {-1,0}}; int main() { scanf("%lld %lld", &n, &m); for(lli i = 1;i<=n;i++) for(lli j = 1;j<=m;j++){ char c; scanf(" %c", &c); //cin >> c; if(c == 'F') diz[i][j] = 1; else if(c == 'R') diz[i][j] = 2; } queue<pplli> R; queue<pplli> F; R.push({1, {1,1}}); bool hang = 0; lli enb = 0; while(!(R.empty()) || !(F.empty())){ if(R.empty()) hang = 1; else if(F.empty()) hang = 0; pplli su = {0,{0,0}}; if(hang){ su = F.front(); F.pop(); }else{ su = R.front(); R.pop(); } if(vis[su.second.first][su.second.second]) continue; vis[su.second.first][su.second.second] = 1; enb = max(enb, su.first); for(plli yon : yonler){ lli x = su.second.first + yon.first; lli y = su.second.second + yon.second; if(vis[x][y]) continue; if(!diz[x][y]) continue; if(diz[x][y] == diz[su.second.first][su.second.second]){ if(hang) F.push({su.first, {x,y}}); else R.push({su.first, {x,y}}); }else{ if(hang) R.push({su.first + 1, {x,y}}); else F.push({su.first + 1, {x,y}}); } } } printf("%lld", enb); }

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

tracks.cpp: In function 'int main()':
tracks.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     scanf("%lld %lld", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
tracks.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf(" %c", &c);
      |             ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...