結果

問題 No.3067 +10 Seconds Clock
ユーザー SnowBeenDiding
提出日時 2025-03-21 21:33:42
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 17 ms / 2,000 ms
+ 400µs
コード長 804 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,336 ms
コンパイル使用メモリ 381,804 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-11-11 04:36:02
合計ジャッジ時間 6,677 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    int n, t;
    cin >> n >> t;
    int power = 0;
    int nw = t;
    vector<int> ts(n - 1), p(n - 1);
    rep(i, 0, n - 1) cin >> ts[i];
    int m;
    cin >> m;
    while (m--) {
        int x;
        cin >> x;
        p[x - 2] = 1;
    }
    int ans = 0;
    rep(i, 0, n - 1) {
        t -= ts[i];
        while (t <= 0 && power) {
            t += 10;
            ans++;
            power--;
        }
        if (t <= 0) {
            cout << -1 << endl;
            return 0;
        }
        power += p[i];
    }
    cout << ans << endl;
}
0