結果

問題 No.3067 +10 Seconds Clock
ユーザー karinohito
提出日時 2025-03-21 22:55:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 2,273 ms
コンパイル使用メモリ 198,380 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 22:55:16
合計ジャッジ時間 3,555 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll=long long;
#include<atcoder/modint>
using namespace atcoder;
using mint=modint998244353;


int main(){
	
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll N,T;
	cin>>N>>T;
	vector<ll> P(N-1);
	for(int i=0;i<N-1;i++)cin>>P[i];
	vector<bool> E(N+2,0);
	ll K;
	cin>>K;
	for(int i=0;i<K;i++){
		ll x;
		cin>>x;
		E[x]=1;
	} 
	ll an=0;
	ll S=0;
	ll Z=T;
	for(int i=0;i<N-1;i++){
		Z-=P[i];
		if(Z<=0){
			ll U=(-Z+10)/10;
			if(U>S){
				cout<<-1<<endl;
				return 0;
			}
			Z+=U*10;
			S-=1;
			an+=U;
		}
		if(E[i+2])S++;
	}
	cout<<an<<endl;
}

0