結果

問題 No.3067 +10 Seconds Clock
ユーザー snrnsidy
提出日時 2025-03-21 21:34:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 2,203 ms
コンパイル使用メモリ 194,312 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-21 21:34:28
合計ジャッジ時間 3,530 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 9 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

bool chk[200005];
int n,m,k,x;
int t[200005];

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

    cin >> n >> m;
    for(int i=1;i<n;i++) cin >> t[i];
    cin >> k;
    for(int i=0;i<k;i++)
    {
        cin >> x;
        chk[x] = true;
    }

    int res = 0;
    int cnt = 0;

    for(int i=1;i<n;i++)
    {
        if(m <= t[i])
        {
            int x = ceil((t[i] - m)*1.0/10);
            if(cnt < x)
            {
                res = -1;
                break;
            }
            res += x;
            cnt-=x;
            m += (10*x);
            m -= t[i];
        }
        else
        {
            m -= t[i];
            if(chk[i+1]) cnt+=1;
        }
    }
    cout << res << '\n';
 	return 0;
}
0