제출 #1143037

#제출 시각아이디문제언어결과실행 시간메모리
1143037hewhocooksTracks in the Snow (BOI13_tracks)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> // #include <atcoder/all> using namespace std; #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; }

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

tracks.cpp:17:51: warning: overflow in conversion from 'double' to 'int' changes value from '2.0e+18' to '2147483647' [-Woverflow]
   17 | const int mod1 = 1e9 + 7, mod2 = 998244353, INF = 2e18, N = 2e5 + 5, L = 19;
      |                                                   ^~~~
/tmp/ccND3wP6.o: in function `inside(int, int)':
tracks.cpp:(.text+0x8e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccND3wP6.o
/tmp/ccND3wP6.o: in function `solve()':
tracks.cpp:(.text+0x1b9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x1cd): 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+0x201): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x20f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x235): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x25c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x3fa): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccND3wP6.o
tracks.cpp:(.text+0x43e): 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