結果

問題 No.3067 +10 Seconds Clock
ユーザー kenti
提出日時 2025-03-23 11:21:01
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 758 bytes
コンパイル時間 3,633 ms
コンパイル使用メモリ 278,432 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2025-03-23 11:21:07
合計ジャッジ時間 5,654 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int N, T; cin >> N >> T;
    vector<int> t(N - 1);
    for (int i = 0; i < N - 1; i++) cin >> t[i];
    int K; cin >> K;
    set<int> x;
    for (int i = 0; i < K; i++) {
        int tmp; cin >> tmp;
        x.insert(tmp);
    }
    int ts = 0;
    for (int i = 0; i < N - 1; i++) {
        ts += t[i];
    }
    int ans = max(0, (ts - T) / 10 + 1);
    for (int i = 0; i < N - 1; i++) {
        T -= t[i];
        if (T <= 0) {
            cout << -1 << "\n";
            return 0;
        }
        if (T > 0 && x.contains(i + 2)) {
            T += 10;
        }
    }
    cout << ans << "\n";
    return 0;
}
0