Submission #1268545

#TimeUsernameProblemLanguageResultExecution timeMemory
1268545buzzy2Tracks in the Snow (BOI13_tracks)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long vector<pair<int,int>> dirs = {{0,1},{1,0},{-1,0},{0,-1}}; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<vector<char>> v(n,vector<char>(m)); for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) cin >> v[i][j]; } vector<vector<int>> dist(n,vector<int>(m,-1)); deque<tuple<int,int,int>> q; q.push_front({0,0,0}); while(!q.empty()) { const auto [i,j,w] = q.front(); q.pop_front(); dist[i][j] = w; for(const auto& [a,b] : dirs) { int ni = a + i, nj = j + b; if(ni < 0 || nj < 0 || ni >= n || nj >= m || dist[ni][nj] != -1 || v[ni][nj] == '.') continue; if(v[ni][nj] != v[i][j]) { q.push_back({ni,nj,w+1}); } else { q.push_front({ni,nj,w}); } } } int ans = -1; for(const vector<int>& i : dist) for(int j : i) ans = max(ans,j); cout<<ans+1<<endl;

Compilation message (stderr)

tracks.cpp: In function 'int main()':
tracks.cpp:42:23: error: expected '}' at end of input
   42 |     cout<<ans+1<<endl;
      |                       ^
tracks.cpp:7:15: note: to match this '{'
    7 | signed main() {
      |               ^