# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
594172 | Zanite | Collecting Stamps 3 (JOI20_ho_t3) | C++17 | 1 ms | 212 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.
// I am now here, but I have yet to prove that I am worthy of my place here.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define fi first
#define se second
const int maxN = 201;
const ll INF = 1e18;
ll N, L;
pll stamps[maxN];
ll CW[maxN], CCW[maxN];
ll dp[maxN][maxN];
int main() {
scanf("%lld %lld", &N, &L);
for (ll i = 1; i <= N; i++) {scanf("%lld", &stamps[i].fi);}
for (ll i = 1; i <= N; i++) {scanf("%lld", &stamps[i].se);}
sort(stamps + 1, stamps + N+1);
for (ll i = 1; i <= N; i++) {
CW[i] = stamps[i].fi;
CCW[i] = L - CW[i];
}
ll ans = 0;
// clockwise
for (ll en = 1; en <= N; en++) {
ll cur = 0;
for (ll i = 1; i <= en; i++) {
if (CW[i] <= stamps[i].se) cur++;
}
ll d = 2*CW[en];
for (ll i = N; i > en; i--) {
if (d+CCW[i] <= stamps[i].se) cur++;
}
ans = max(ans, cur);
}
// counterclockwise
for (ll en = 1; en <= N; en++) {
ll cur = 0;
for (ll i = N; i >= en; i--) {
if (CCW[i] <= stamps[i].se) cur++;
}
ll d = 2*CCW[en];
for (ll i = 1; i < N; i++) {
if (d+CW[i] <= stamps[i].se) cur++;
}
ans = max(ans, cur);
}
printf("%lld\n", ans);
}
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... |