結果
問題 | No.3067 +10 Seconds Clock |
ユーザー |
|
提出日時 | 2025-03-21 21:43:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 824 bytes |
コンパイル時間 | 2,329 ms |
コンパイル使用メモリ | 196,492 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 21:43:13 |
合計ジャッジ時間 | 3,346 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void solve() { ll n, T; cin >> n >> T; vector<ll> t(n, 0); rep(i, n - 1) cin >> t[i + 1]; vector<bool> x(n, false); { ll k; cin >> k; rep(i, k) { ll a; cin >> a; x[a - 1] = true; } } ll ans = 0, c = 0; rep(i, n - 1) { T -= t[i + 1]; if (T <= 0) { ll r = (abs(T) + 9) / 10; if (T % 10 == 0) r++; ans += r; T += r * 10; c -= r; } if (c < 0) { cout << "-1\n"; return; } if (x[i + 1]) c++; } cout << ans << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }