# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252016 | DS007 | Boat (APIO16_boat) | C++14 | 980 ms | 20180 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 500, mod = 1e9 + 7;
int a[N], b[N];
int dp[2][N * N * 3];
int n;
int solveTestCase() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i] >> b[i];
vector<int> v = {0};
for (int i = 0; i < n; i++) {
for (int j = 0; j <= n; j++)
v.push_back(a[i] + j), v.push_back(a[i] - j), v.push_back(b[i] + j), v.push_back(b[i] - j);
}
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
for (int i = 0; i < n; i++) {
a[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin();
b[i] = lower_bound(v.begin(), v.end(), b[i]) - v.begin();
}
dp[0][0] = 1;
for (int i = a[0]; i <= b[0]; i++)
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |