Submission #1286995

#TimeUsernameProblemLanguageResultExecution timeMemory
1286995loomToy (CEOI24_toy)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define inf (int)2e18 #define nl '\n' const int N = 360; int a[N][N], pk[N][N], pl[N][N]; unordered_map<int, bool> vis[N][N][N]; int n, m, k, l, tx, ty; vector<pair<int,int>> v = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; bool valid(int xk, int yk, int xl, int yl){ if(xk < 0 or xk >= n or yk < 0 or yk+k-1 >= m or xl < 0 or xl+l-1 >= n or yl < 0 or yl >= m) return 0; if(pk[xk][yk+k-1] - (yk == 0 ? 0 : pk[xk][yk-1])) return 0; if(pl[xl+l-1][yl] - (xl == 0 ? 0 : pl[xl-1][yl])) return 0; return xl <= xk and xl+l-1 >= xk and yl >= yk and yl <= yk+k-1; } bool dfs(int xk, int yk, int xl, int yl){ vis[xk][yk][xl][yl] = 1; if(xk == tx and yl == ty) return 1; for(auto &[i, j] : v){ int nxk = xk + i, nyk = yk + j; if(valid(nxk, nyk, xl, yl) and !vis[nxk][nyk][xl][yl] and dfs(nxk, nyk, xl, yl)) return 1; } for(auto &[i, j] : v){ int nxl = xl + i, nyl = yl + j; if(valid(xk, yk, nxl, nyl) and !vis[xk][yk][nxl][nyl] and dfs(xk, yk, nxl, nyl)) return 1; } return 0; } void solve(){ int yk, xk, yl, xl; cin>>m>>n>>k>>l>>yk>>xk>>yl>>xl; string a[n]; for(int i = 0; i < n; i++){ cin>>a[i]; for(int j = 0; j < m; j++){ if(a[i][j] == '*'){ tx = i; ty = j; } pk[i][j] = (j == 0 ? 0 : pk[i][j-1]) + (a[i][j] == 'X'); pl[i][j] = (i == 0 ? 0 : pl[i-1][j]) + (a[i][j] == 'X'); } } cout<<(dfs(xk, yk, xl, yl) ? "YES" : "NO"); } signed main(){ ios_base::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL); int t = 1; //cin>>t; while(t--) solve(); return 0; }

Compilation message (stderr)

/tmp/ccYZnGIa.o: in function `valid(long long, long long, long long, long long)':
Main.cpp:(.text+0x142): relocation truncated to fit: R_X86_64_PC32 against symbol `pk' defined in .bss section in /tmp/ccYZnGIa.o
Main.cpp:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `pl' defined in .bss section in /tmp/ccYZnGIa.o
/tmp/ccYZnGIa.o: in function `solve()':
Main.cpp:(.text+0x44f): 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/13/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x55d): relocation truncated to fit: R_X86_64_PC32 against symbol `pl' defined in .bss section in /tmp/ccYZnGIa.o
Main.cpp:(.text+0x564): relocation truncated to fit: R_X86_64_PC32 against symbol `pk' defined in .bss section in /tmp/ccYZnGIa.o
Main.cpp:(.text+0x576): 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/13/libstdc++.a(globals_io.o)
Main.cpp:(.text+0x66c): 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/13/libstdc++.a(globals_io.o)
/tmp/ccYZnGIa.o: in function `main':
Main.cpp:(.text.startup+0x12): 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/13/libstdc++.a(globals_io.o)
Main.cpp:(.text.startup+0x1d): 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/13/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x22): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2f): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1f): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1ed): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x252): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2bc): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x316): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x50f): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x57d): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5f0): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x654): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status