結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2025-03-21 21:55:32 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 920 bytes |
| コンパイル時間 | 5,389 ms |
| コンパイル使用メモリ | 332,532 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-21 21:55:40 |
| 合計ジャッジ時間 | 6,777 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
int main() {
FAST_IO
auto ans = 0LL;
int N,T;
cin >> N >> T;
vector<i64> t(N-1);
for (auto& x : t) cin >> x;
int K;
cin >> K;
vector<int> x(K);
for (auto& y : x) cin >> y;
vector<bool> x2(N);
for (int i = 0; i < K; i ++) {
x2[x[i]-1] = true;
}
i64 tm = 0;
for (int i = 0; i < N-1; i ++) {
if (T + tm * 10 <= t[i]) {
ans = -1;
break;
}
T -= t[i];
if (T <= 0) {
auto t = abs(T) / 10 + 1;
T += t * 10;
tm -= t;
ans += t;
}
if (x2[i+1]) {
tm ++;
}
}
cout << ans << endl;
}
hiromi_ayase