Submission #1115695

#TimeUsernameProblemLanguageResultExecution timeMemory
1115695vjudge1Potatoes and fertilizers (LMIO19_bulves)C++17
Compilation error
0 ms0 KiB
// #pragma comment(linker, "/stack:200000000") // #pragma GCC optimize("Ofast") // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4") // #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") // #define _GLIBCXX_DEBUG // #define _GLIBCXX_DEBUG_PEDANTIC #include <iomanip> #include <cassert> #include <iostream> #include <vector> #include <random> #include <algorithm> #include <map> #include <set> #include <functional> #include <array> #include <numeric> #include <queue> #include <deque> #include <bitset> #include <cmath> #include <climits> #include <cstdint> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #include <ext/rope> // using namespace __gnu_pbds; // using namespace __gnu_cxx; using namespace std; const int MOD = 998244353; const long double PI = 3.141592653589793; using ll = long long; const ll INF = 1e18; // #define int ll // --------> sashko123`s defines: #define itn int //Vasya sorry :( #define p_b push_back #define fi first #define se second #define pii std::pair<int, int> #define oo LLONG_MAX #define big INT_MAX #define elif else if int input() { int x; cin >> x; return x; } // ----------> end of sashko123`s defines (thank you Vasya <3) // template<typename K, typename V> // using hash_table = cc_hash_table<K, V, hash<K>>; // template<typename T> // using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; const int N = 3001; const int M = 300000; ll dp[N][2 * M + 10]; void solve() { int n; cin >> n; vector<int> c(n + 1); for (int i = 1; i <= n; i++) { int a, b; cin >> a >> b; c[i] = a - b; } for (int j = -M; j <= M; j++) { dp[0][j + M] = INF; } dp[0][M] = 0; for (int i = 1; i <= n; i++) { for (int j = -M; j <= M; j++) { dp[i][j + M] = INF; } ll mn = INF; for (int j = -M; j <= M; j++) { if (j + c[i] >= -M && j + c[i] <= M) dp[i][j + c[i] + M] = min(dp[i][j + c[i] + M], dp[i - 1][j + M] + abs(j)); } for (int j = M - 1; j >= -M; j--) { dp[i][j + M] = min(dp[i][j + M], dp[i][j + M + 1]); } } cout << dp[n][0 + M]; } int32_t main(int32_t argc, const char * argv[]) { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); // insert code here... int tt= 1; // std::cin >> tt; for (int t = 1; t <= tt; t++) { // cout << "Case #" << t << ": "; solve(); } return 0; }

Compilation message (stderr)

bulves.cpp: In function 'void solve()':
bulves.cpp:90:6: warning: unused variable 'mn' [-Wunused-variable]
   90 |   ll mn = INF;
      |      ^~
/tmp/ccJfCmpN.o: in function `input()':
bulves.cpp:(.text+0xb): 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)
/tmp/ccJfCmpN.o: in function `solve()':
bulves.cpp:(.text+0x59): 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)
bulves.cpp:(.text+0xf8): 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)
bulves.cpp:(.text+0x261): 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/ccJfCmpN.o: in function `main':
bulves.cpp:(.text.startup+0xd): 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)
bulves.cpp:(.text.startup+0x18): 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/ccJfCmpN.o: in function `_GLOBAL__sub_I__Z5inputv':
bulves.cpp:(.text.startup+0x4b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
bulves.cpp:(.text.startup+0x69): 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