Submission #617498

#TimeUsernameProblemLanguageResultExecution timeMemory
617498HazemAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define F first #define S second #define LL long long using namespace std; const int N = 2e5+10; const LL LINF = 1e18; pair<int,int>p[N]; LL dp[N],dp1[N]; LL C[N][N]; bool cmp(pair<int,int>p1,pair<int,int>p2){ if(p1.F!=p2.F) return p1.F<p2.F; return p1.S>p2.S; } void compute(int l, int r, int optl, int optr) { if (l > r) return; int mid = (l + r) >> 1; pair<long long, int> best = {LLONG_MAX, -1}; for (int k = optl; k <= min(mid, optr); k++) { best = min(best, {(k ? dp[k - 1] : 0) + C[k][mid], k}); } dp1[mid] = best.first; int opt = best.second; compute(l, mid - 1, optl, opt); compute(mid + 1, r, opt, optr); } long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) { for(int i=0;i<n;i++){ if(r[i]>c[i]) swap(r[i],c[i]); p[i] = {c[i],r[i]}; } sort(p,p+n); vector<pair<int,int>>vec; int mn = 1e9+10; for(int i=n-1;i>=0;i--){ if(mn<=p[i].S) continue; vec.push_back(p[i]); mn = min(mn,p[i].S); } vec.push_back({-1,-1}); reverse(vec.begin(),vec.end()); n = vec.size()-1; for(int i=1;i<=n;i++) for(int j=1;j<=i;j++){ LL d = (vec[i].F-vec[j].S+1),d1 = max(0,vec[j-1].F-vec[j].S+1); d *= d; d1 *= d1; C[j][i] = d-d1; } for(int i=1;i<=n;i++) dp[i] = C[1][i]; LL ans = dp[n]; for(int i=2;i<=k;i++){ dp[0] = LINF; compute(1, n, 1, n); for(int j=1;j<=n;j++) dp[j] = dp1[j]; ans = min(ans,dp[n]); } return ans; }

Compilation message (stderr)

/tmp/ccP9cV71.o: in function `compute(int, int, int, int)':
aliens.cpp:(.text+0x4e9): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x5c3): relocation truncated to fit: R_X86_64_PC32 against symbol `dp1' defined in .bss section in /tmp/ccP9cV71.o
/tmp/ccP9cV71.o: in function `take_photos(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)':
aliens.cpp:(.text+0x633): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x69c): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x6c1): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x6d1): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x718): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x756): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x89e): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x8aa): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccP9cV71.o
aliens.cpp:(.text+0x8fe): 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