結果
| 問題 | No.3067 +10 Seconds Clock |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-03-23 17:35:11 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 2,000 ms |
| コード長 | 830 bytes |
| 記録 | |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 53,740 KB |
| 実行使用メモリ | 9,272 KB |
| 最終ジャッジ日時 | 2026-07-07 20:48:12 |
| 合計ジャッジ時間 | 1,692 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3067.cc: No.3067 +10 Seconds Clock - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
/* global variables */
int ts[MAX_N], xs[MAX_N];
/* subroutines */
/* main */
int main() {
int n, t;
scanf("%d%d", &n, &t);
for (int i = 1; i < n; i++) scanf("%d", ts + i);
int k;
scanf("%d", &k);
for (int i = 0; i < k; i++) scanf("%d", xs + i), xs[i]--;
int cnt = 0, xc = 0;
for (int i = 0, j = 0; i < n; i++) {
t -= ts[i];
//printf(" i=%d, t=%d, xc=%d\n", i, t, xc);
if (t <= 0) {
int d = -t / 10 + 1;
if (d > xc) { puts("-1"); return 0; }
t += d * 10;
cnt += d, xc -= d;
}
if (j < k && i == xs[j]) xc++, j++;
}
printf("%d\n", cnt);
return 0;
}
tnakao0123