QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#753982 | #4931. Comic Binge | MeatInTheMiddle# | Compile Error | / | / | C++17 | 1.5kb | 2024-11-16 13:59:49 | 2024-11-16 13:59:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fastio (ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL))
typedef long long ll;
typedef long double lld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const int MAXSIZE = 2000000;
const long long INF = 1e9 + 5;
const double EPSILON = 1e-14;
const ll DIV = 2000003;
const long double pi = 3.14159265358979323846264338327950288419716939937510L;
int n;
int dp[1005][1005][1002][3];
int A[1005], B[1005];
int psum[1005];
pair<int, int> find(int l, int r, int tm, int rem)
{
for (int i = l; i < r; i++)
{
if (A[i] <= rem + tm)
{
tm = 0;
rem -= A[i] - tm;
}
else
{
return {i, rem};
}
}
return {r, 0};
}
int solve(int l, int r, int tm, int c)
{
if (r == n + 1)
return psum[n] - psum[l - 1] - tm;
int &ret = dp[l][r][tm][c];
if (ret != -1)
return ret;
ret = INF;
if (c == 1)
{
ret = min(ret, solve(l, r + 1, tm, 0));
}
auto p = find(l, r, tm, B[r]);
ret = min(ret, solve(p.first, r + 1, p.second, 1) + B[r]);
return ret;
}
int main()
{
fastio;
memset(dp, -1, sizeof dp);
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> A[i];
psum[i] = psum[i - 1] + A[i];
}
for (int i = 1; i <= n; i++)
{
cin >> B[i];
}
cout << solve(1, 1, 0, 0);
return 0;
}
Details
/tmp/ccwwG80t.o: in function `solve(int, int, int, int)': answer.code:(.text+0x67): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccwwG80t.o /tmp/ccwwG80t.o: in function `main': answer.code:(.text.startup+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccwwG80t.o answer.code:(.text.startup+0x5c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccwwG80t.o answer.code:(.text.startup+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccwwG80t.o answer.code:(.text.startup+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccwwG80t.o collect2: error: ld returned 1 exit status