結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2025-03-21 21:30:23 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 800 bytes |
| コンパイル時間 | 3,076 ms |
| コンパイル使用メモリ | 276,568 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 21:30:28 |
| 合計ジャッジ時間 | 4,301 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge7 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, T;
cin >> N >> T;
vector<int> t(N);
for (int i = 1; i < N; i++) cin >> t[i];
int K;
cin >> K;
vector<bool> f(N);
while (K--) {
int x;
cin >> x;
f[x - 1] = true;
}
int cnt = 0, ans = 0;
for (int i = 1; i < N; i++) {
if (T > t[i]) {
T -= t[i];
} else {
int need = (t[i] - T + 10) / 10;
if (need > cnt) {
cout << -1 << endl;
return 0;
}
cnt -= need;
T += 10 * need;
T -= t[i];
ans += need;
}
cnt += f[i];
}
cout << (T > 0 ? ans : -1) << endl;
}
nonon