提出 #73528700


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll a[200020], b[200020];

void solve()
{
    ll n,d;
    cin>>n>>d;
    for (ll i=1;i<=n;i++) cin>>a[i];
    for (ll i=1;i<=n;i++) cin>>b[i];
    deque<ll> dq;
    for (ll i=1;i<=n;i++)
    {
        for (ll j=1;j<=a[i];j++) dq.push_back(i);
        for (ll j=1;j<=b[i];j++) dq.pop_front();
        while (!dq.empty()&&i-dq.front()>=d) dq.pop_front();
    }
    cout<<dq.size()<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll tc;
    cin>>tc;
    while (tc--) solve();
}

提出情報

提出日時
問題 C - Omelette Restaurant
ユーザ prologue1017
言語 C++23 (GCC 15.2.0)
得点 300
コード長 601 Byte
結果 AC
実行時間 35 ms
メモリ 21172 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 30
セット名 テストケース
Sample example_00.txt
All example_00.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3512 KiB
hand_00.txt AC 20 ms 21172 KiB
hand_01.txt AC 15 ms 6756 KiB
hand_02.txt AC 14 ms 6772 KiB
hand_03.txt AC 15 ms 6760 KiB
hand_04.txt AC 15 ms 6780 KiB
hand_05.txt AC 35 ms 3556 KiB
hand_06.txt AC 13 ms 8180 KiB
hand_07.txt AC 27 ms 6644 KiB
hand_08.txt AC 1 ms 3556 KiB
random_00.txt AC 20 ms 3580 KiB
random_01.txt AC 24 ms 3700 KiB
random_02.txt AC 20 ms 3496 KiB
random_03.txt AC 20 ms 3572 KiB
random_04.txt AC 20 ms 3580 KiB
random_05.txt AC 15 ms 3784 KiB
random_06.txt AC 15 ms 3788 KiB
random_07.txt AC 15 ms 3828 KiB
random_08.txt AC 15 ms 3736 KiB
random_09.txt AC 15 ms 3816 KiB
random_10.txt AC 16 ms 6760 KiB
random_11.txt AC 17 ms 6680 KiB
random_12.txt AC 17 ms 6696 KiB
random_13.txt AC 17 ms 6812 KiB
random_14.txt AC 16 ms 6756 KiB
random_15.txt AC 16 ms 6712 KiB
random_16.txt AC 17 ms 6760 KiB
random_17.txt AC 16 ms 6756 KiB
random_18.txt AC 16 ms 6780 KiB
random_19.txt AC 16 ms 6780 KiB