Submission #940909

# Submission time Handle Problem Language Result Execution time Memory
940909 2024-03-08T02:02:35 Z LittleOrange Collecting Stamps 3 (JOI20_ho_t3) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    ll n,l;
    cin >> n >> l;
    vector<ll> x(n),t(n);
    for(ll &i : x) cin >> i;
    for(ll &i : t) cin >> i;
    vector<ll> rx(n),rt(n);
    for(ll i = 0;i<n;i++){
        rx[i] = l-x[n-1-i];
        rt[i] = t[n-1-i];
    }
    ll ans = 0;
    {
        ll cur = 0;
        for(ll i = 0;i<n;i++) cur += t[i]>=x[i];
        ans = max(ans,cur);
    }
    {
        ll cur = 0;
        for(ll i = 0;i<n;i++) cur += rt[i]>=rx[i];
        ans = max(ans,cur);
    }
    for(ll i = 0;i<n;i++){
        ll w = x[i];
        ll cur = 0;
        for(ll j = 0;j<=i;j++) cur += t[j]>=x[j];
        w*=2;
        for(ll j = 0;j+i<n-1;j++) cur += rt[j]>=rx[j]+w;
        ans = max(ans,cur);
    }
    for(ll i = 0;i<n;i++){
        ll w = rx[i];
        ll cur = 0;
        for(ll j = 0;j<=i;j++) cur += rt[j]>=rx[j];
        w*=2;
        for(ll j = 0;j+i<n-1;j++) cur += t[j]>=x[j]+w;
        ans = max(ans,cur);
    }
    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -