提出 #73483184


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() 
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt;
    cin >> tt;
    while(tt--)
    {
        int n, d, s = 0;
        cin >> n >> d;
        vector<int> v;
        int a[n], b[n];
        for(int i = 0; i < n; i++)
            cin >> a[i];
        for(int i = 0; i < n; i++)
            cin >> b[i];
        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < a[i]; j++)
                v.push_back(i);
            s += b[i];
            while(s < v.size() && v[s] <= i - d)
                s++;
        }
        cout << v.size() - s << '\n';
    }
    return 0;
}

提出情報

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

コンパイルエラー

./Main.cpp: In function 'int main()':
./Main.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             while(s < v.size() && v[s] <= i - d)
      |                   ~~^~~~~~~~~~

ジャッジ結果

セット名 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 3652 KiB
hand_00.txt AC 18 ms 13300 KiB
hand_01.txt AC 18 ms 13312 KiB
hand_02.txt AC 18 ms 13276 KiB
hand_03.txt AC 18 ms 13304 KiB
hand_04.txt AC 18 ms 13168 KiB
hand_05.txt AC 37 ms 3496 KiB
hand_06.txt AC 12 ms 7088 KiB
hand_07.txt AC 27 ms 8404 KiB
hand_08.txt AC 1 ms 3652 KiB
random_00.txt AC 20 ms 3552 KiB
random_01.txt AC 20 ms 3496 KiB
random_02.txt AC 21 ms 3652 KiB
random_03.txt AC 20 ms 3588 KiB
random_04.txt AC 20 ms 3544 KiB
random_05.txt AC 14 ms 3880 KiB
random_06.txt AC 14 ms 3904 KiB
random_07.txt AC 14 ms 3908 KiB
random_08.txt AC 13 ms 3992 KiB
random_09.txt AC 13 ms 3812 KiB
random_10.txt AC 16 ms 9220 KiB
random_11.txt AC 16 ms 9052 KiB
random_12.txt AC 16 ms 9196 KiB
random_13.txt AC 15 ms 9208 KiB
random_14.txt AC 16 ms 9172 KiB
random_15.txt AC 16 ms 9232 KiB
random_16.txt AC 16 ms 9136 KiB
random_17.txt AC 16 ms 9128 KiB
random_18.txt AC 16 ms 9208 KiB
random_19.txt AC 16 ms 9212 KiB