Submission #651791

#TimeUsernameProblemLanguageResultExecution timeMemory
651791_HDHBuilding 4 (JOI20_building4)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #ifdef LOCAL #include <debug.h> #else #define debug(...) 1001 #endif using namespace std; #define all(x) x.begin(), x.end() #define st first #define nd second #define lb lower_bound #define ub upper_bound #define sz(x) (int)x.size() #define pb push_back #define pob pop_back #define pf push_front #define pof pop_front #define file "TEMPLATE" typedef long long ll; typedef pair<int, int> ii; typedef array<int, 3> iii; typedef vector<int> vi; typedef vector<ll> vl; bool const SINGLE_TEST = 1; int const N = 2e4 + 1; ll const INF = LLONG_MIN; int n; int arr[N][2]; bool is[N][N][2]; ll dp[N][N][2]; int p[N][N][2]; ll emrua(int i, int cnt, int last){ if (cnt < 0) return INF; if (i == 2 * n + 1) return (!cnt? 0: INF); if (is[i][cnt][last]) return dp[i][cnt][last]; ll x = emrua(i + 1, cnt - 1, 0) + arr[i][0]; if (arr[i - 1][last] > arr[i][0]) x = INF; ll y = emrua(i + 1, cnt, 1) + arr[i][0]; if (arr[i - 1][last] > arr[i][1]) y = INF; if (x > y) p[i][cnt][last] = 'A'; else p[i][cnt][last] = 'B'; is[i][cnt][last] = 1; return dp[i][cnt][last] = max(x, y); } void solve(){ cin >> n; for (int i = 1; i <= 2 * n; i++) cin >> arr[i][0]; for (int j = 1; j <= 2 * n; j++) cin >> arr[j][1]; if (emrua(1, n, 0) < 0){ cout << -1; return; } string ans; for (int i = 1, j = n, z = 0; i <= 2 * n; i++){ if (p[i][j][z] == 'A') ans += 'A', j--, z = 0; else ans += 'B', z = 1; } cout << ans; } int main(){ ios_base::sync_with_stdio(0);// the cin.tie(0);cout.tie(0);// magical lines // freopen(file".inp", "r", stdin); // freopen(file".out", "w", stdout); int t; if (SINGLE_TEST) t = 1; else cin >> t; while (t--) solve(); return 0; }//it's coding time!

Compilation message (stderr)

/tmp/ccL1Wcsw.o: in function `emrua(int, int, int)':
building4.cpp:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `is' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0x5e): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0x175): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccL1Wcsw.o
/tmp/ccL1Wcsw.o: in function `solve()':
building4.cpp:(.text+0x1e9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccL1Wcsw.o
building4.cpp:(.text+0x1f0): 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/10/libstdc++.a(globals_io.o)
building4.cpp:(.text+0x1fd): 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/10/libstdc++.a(globals_io.o)
building4.cpp:(.text+0x205): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status