제출 #736258

#제출 시각아이디문제언어결과실행 시간메모리
736258CookieMaze (JOI23_ho_t3)C++14
19 / 100
2081 ms62560 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; ifstream fin("WINTER.inp"); ofstream fout("WINTER.out"); #define ll long long #define pb push_back #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) #define ld long double #define vt vector #include<fstream> #define fi first #define se second #define pll pair<ll, ll> #define pii pair<int, int> const ld PI = 3.14159265359; const int x[4] = {1, -1, 0, 0}; const int y[4] = {0, 0, 1, -1}; const ll mod = 1e9 + 7; const int mxn = 5e5, mxm = 1e5, sq = 400; const int base = (1 << 18); const ll inf = 1e9; const ld pre = 1e-6; int r, c, n, sti, stj, eni, enj; vt<vt<char>>a; vt<vt<int>>d; bool inside(int i, int j){ return(i >= 1 && j >= 1 && i <= r && j <= c); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> r >> c >> n; a.resize(r + 1, vt<char>(c + 1)); d.resize(r + 1, vt<int>(c + 1)); cin >> sti >> stj >> eni >> enj; forr(i, 1, r + 1){ forr(j, 1, c + 1){ cin >> a[i][j]; d[i][j] = 1e9; } } deque<pair<int, int>>dq; dq.pb({sti, stj}); d[sti][stj] = 0; while(!dq.empty()){ auto [i, j] = dq.front(); dq.pop_front(); if(a[i][j] == '.'){ for(int t = 0; t < 4; t++){ int nwi = i + x[t], nwj = j + y[t]; if(inside(nwi, nwj)){ if(d[nwi][nwj] > d[i][j]){ d[nwi][nwj] = d[i][j]; dq.pb({nwi, nwj}); } } } } for(int ii = i - n; ii <= i + n; ii++){ for(int jj = j - n; jj <= j + n; jj++){ bool ok1 = (ii == i - n || ii == i + n); bool ok2 = (jj == j - n || jj == j + n); if(ok1 && ok2)continue; if(inside(ii, jj)){ if(d[ii][jj] > d[i][j] + 1){ d[ii][jj] = d[i][j] + 1; dq.push_front({ii, jj}); } } } } } cout << d[eni][enj]; return(0); }

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

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