제출 #1228338

#제출 시각아이디문제언어결과실행 시간메모리
1228338mq344Tracks in the Snow (BOI13_tracks)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; char c[maxn][maxn]; int d[maxn][maxn]; int dx[] = {-1,1,0,0}; int dy[] = {0,0,-1,1}; bool vis[maxn][maxn]; int n,m; bool check(int x,int y){ return (x >= 1 && x <= n && y >= 1 && y <= m && c[x][y] != '.' && !vis[x][y]); } void bfs(){ vis[1][1] = true; int ans = 0; deque<pair<int,int>> q; q.push_front({1,1}); d[1][1] = 1; while(!q.empty()){ pair<int,int> u = q.front(); q.pop_front(); ans = max(ans,d[u.first][u.second]); for(int k = 0 ; k < 4; k++){ int xx = u.first + dx[k]; int yy = u.second + dy[k]; if(check(xx,yy)){ if(c[u.first][u.second] == c[xx][yy]){ vis[xx][yy] = true; d[xx][yy] = d[u.first][u.second]; q.push_front({xx,yy}); } else { vis[xx][yy] = true; d[xx][yy] = d[u.first][u.second] + 1; q.push_back({xx,yy}); } } } } cout << ans << endl; } int main(){ cin >> n >> m; for(int i =1; i<= n ;i++){ for(int j = 1 ; j <= m ;j ++) cin >> c[i][j]; } bfs(); }

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

/tmp/cceO5hzq.o: in function `check(int, int)':
tracks.cpp:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cceO5hzq.o
/tmp/cceO5hzq.o: in function `bfs()':
tracks.cpp:(.text+0x185): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cceO5hzq.o
tracks.cpp:(.text+0x1c6): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cceO5hzq.o
tracks.cpp:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cceO5hzq.o
tracks.cpp:(.text+0x239): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cceO5hzq.o
tracks.cpp:(.text+0x24a): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cceO5hzq.o
tracks.cpp:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cceO5hzq.o
tracks.cpp:(.text+0x2ee): 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+0x382): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cceO5hzq.o
/tmp/cceO5hzq.o: in function `main':
tracks.cpp:(.text.startup+0x16): 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.startup+0x44): 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
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status