結果

問題 No.3067 +10 Seconds Clock
ユーザー forest3
提出日時 2025-03-22 10:37:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 162,948 KB
実行使用メモリ 7,320 KB
最終ジャッジ日時 2025-03-22 10:37:34
合計ジャッジ時間 3,360 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
	int N, T, K;
	cin >> N >> T;
	vector<int> t(N - 1);
	rep(i, N - 1) cin >> t[i];
	cin >> K;
	vector<int> x(N);
	rep(i, K) {
		int a;
		cin >> a;
		x[a - 1] = 1;
	}
	int now = T, ans = 0, cnt = 0;
	rep(i, N - 1) {
		now -= t[i];
		if(now <= 0) {
			while(cnt && now <= 0) {
				now += 10;
				ans++;
				cnt--;
			}
			if(now <= 0) {
				cout << -1 << endl;
				return 0;
			}
		}
		if(x[i]) {
			cnt++;
		}
	}
	cout << ans << endl;
} 
0