Submission #1143036

#TimeUsernameProblemLanguageResultExecution timeMemory
1143036hewhocooksTracks in the Snow (BOI13_tracks)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> // #include <atcoder/all> using namespace std; #define int long long #define all(x) (x).begin(), (x).end() typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pair<int, int>> vpi; typedef pair<int, int> pi; #define f first #define s second #define pb push_back #define endl "\n" #define yes cout << "YES" << endl #define no cout << "NO" << endl int dx[] = {-1, 0, 1, 0}; int dy[] = {0, 1, 0, -1}; const int mod1 = 1e9 + 7, mod2 = 998244353, INF = 2e18, N = 2e5 + 5, L = 19; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } // ----------------------------------------------------------------------------- int n, m, depth[N][N]; string snow[N]; bool inside(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < m && snow[x][y] != '.'); } void solve() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> snow[i]; fill(depth[i], depth[i] + m, 0); } int ans = 0; deque<pi> dq; dq.push_back({0, 0}); depth[0][0] = 1; while (!dq.empty()) { auto [x, y] = dq.front(); dq.pop_front(); ans = max(ans, depth[x][y]); for (int i = 0; i < 4; i++) { int newx = x + dx[i], newy = y + dy[i]; if (inside(newx, newy) && depth[newx][newy] == 0) { if (snow[x][y] == snow[newx][newy]) { depth[newx][newy] = depth[x][y]; dq.push_front({newx, newy}); } else { depth[newx][newy] = depth[x][y] + 1; dq.push_back({newx, newy}); } } } } cout << ans << endl; } signed main() { // __START__; ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; cin >> t; while (t--) { solve(); } // __END__; return 0; }

Compilation message (stderr)

/tmp/ccIDsoFk.o: in function `inside(long long, long long)':
tracks.cpp:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0xb3): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccIDsoFk.o
/tmp/ccIDsoFk.o: in function `solve()':
tracks.cpp:(.text+0x1c9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0x1dd): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
tracks.cpp:(.text+0x211): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0x220): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0x245): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0x26d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0x3f9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIDsoFk.o
tracks.cpp:(.text+0x43b): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
tracks.cpp:(.text+0x493): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
collect2: error: ld returned 1 exit status