Submission #757747

#TimeUsernameProblemLanguageResultExecution timeMemory
757747drdilyorTracks in the Snow (BOI13_tracks)C++17
0 / 100
1012 ms1034492 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; signed main() { cin.tie(0)->sync_with_stdio(0); int n, m; cin >> n >> m; vector<string> mat(n); for (string& s : mat) { cin >> s; s.resize(n); } int di[]{0, 0, -1, 1}; int dj[]{-1, 1, 0, 0}; vector vis(n, vector<bool>(m)); int cnt = 0; auto dfs = [&](auto& dfs, int i, int j)->void { cnt++; if (!(cnt & (1<<20)-1)) cout << cnt << endl; vis[i][j] = 1; for (int d = 0; d < 4; d++) { int ei = i + di[d]; int ej = j + dj[d]; if (0 <= ei && ei < n && 0 <= ej && ej < m && !vis[ei][ej]) dfs(dfs, ei, ej); } }; dfs(dfs, 0, 0); return 0; }

Compilation message (stderr)

tracks.cpp: In instantiation of 'main()::<lambda(auto:23&, int, int)> [with auto:23 = main()::<lambda(auto:23&, int, int)>]':
tracks.cpp:32:18:   required from here
tracks.cpp:23:28: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   23 |         if (!(cnt & (1<<20)-1)) cout << cnt << endl;
      |                     ~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...