結果
問題 | No.3067 +10 Seconds Clock |
ユーザー |
![]() |
提出日時 | 2025-03-21 21:33:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 804 bytes |
コンパイル時間 | 5,776 ms |
コンパイル使用メモリ | 333,516 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 21:33:49 |
合計ジャッジ時間 | 7,234 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#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; }