結果

問題 No.3067 +10 Seconds Clock
ユーザー GOTKAKO
提出日時 2025-03-21 21:30:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 197,632 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 21:30:13
合計ジャッジ時間 3,136 ms
ジャッジサーバーID
(参考情報)
judge7 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,T; cin >> N >> T;
    vector<int> A(N-1);
    for(auto &t : A) cin >> t;

    vector<bool> X(N);
    int K; cin >> K;
    while(K--){
        int p; cin >> p; p -= 2;
        X.at(p) = true; 
    }

    int have = 0,answer = 0,idx = 0;
    for(auto t : A){
        T -= t;
        while(T <= 0){
            if(have == 0){answer = -1; break;}
            have -= 1; answer += 1; T += 10;
        }
        if(answer == -1) break;
        if(X.at(idx)) have++;
        idx++;
    }
    cout << answer << endl;
}
0