Submission #1100218

#TimeUsernameProblemLanguageResultExecution timeMemory
1100218vjudge1Coin Collecting (JOI19_ho_t4)C++98
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int dp[N][N]; int main() { int n; cin >> n; vector<pair<int, int>> a(2 * n); for(int i = 0; i < 2 * n; i++) { cin >> a[i].first >> a[i].second; } sort(a.begin(), a.end()); for(int i = 0; i <= n; i++) { for(int j = 0; j <= n; j++) { dp[i][j] = INT_MAX; } } dp[0][0] = 0; for(int i = 0; i < 2 * n; i++) { for(int j = 0; j <= i; j++) { int k = i - j; if(j < n) { dp[j + 1][k] = min(dp[j + 1][k], dp[j][k] + abs(a[i].first - (j + 1)) + abs(1 - a[i].second)); } if(k < n) { dp[j][k + 1] = min(dp[j][k + 1], dp[j][k] + abs(a[i].first - (k + 1)) + abs(2 - a[i].second)); } } } cout << dp[n][n]; }

Compilation message (stderr)

/tmp/ccGvuGHG.o: in function `main':
joi2019_ho_t4.cpp:(.text.startup+0x9): 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)
joi2019_ho_t4.cpp:(.text.startup+0xc1): 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)
joi2019_ho_t4.cpp:(.text.startup+0x2f5): 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/10/libstdc++.a(globals_io.o)
/tmp/ccGvuGHG.o: in function `_GLOBAL__sub_I_dp':
joi2019_ho_t4.cpp:(.text.startup+0x39b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
joi2019_ho_t4.cpp:(.text.startup+0x3b9): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status