結果
問題 | No.3067 +10 Seconds Clock |
ユーザー |
![]() |
提出日時 | 2025-03-21 21:42:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 1,033 bytes |
コンパイル時間 | 3,823 ms |
コンパイル使用メモリ | 278,576 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2025-03-21 21:42:37 |
合計ジャッジ時間 | 4,845 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/modint> using namespace std; //using namespace atcoder; using ll = long long; //using mint = modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll N, T, K, x, c=0, ans=0; cin >> N >> T; vector<ll> t(N); for (int i=1; i<=N-1; i++) cin >> t[i]; cin >> K; vector<bool> ok(N); for (int i=0; i<K; i++){ cin >> x; ok[x] = 1; } for (int i=1; i<=N-1; i++){ if (ok[i]) c++; T -= t[i]; if (T <= 0){ x = (-T+10-1)/10; if (x > c){ cout << -1 << endl; return 0; } T += 10 * x; c -= x; ans += x; if (T == 0){ if (c == 0){ cout << -1 << endl; return 0; } T += 10; c--; ans++; } } } cout << ans << endl; return 0; }