結果
問題 | No.3067 +10 Seconds Clock |
ユーザー |
|
提出日時 | 2025-03-21 22:57:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 2,117 ms |
コンパイル使用メモリ | 197,376 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 22:57:27 |
合計ジャッジ時間 | 3,635 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#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-=U; an+=U; } if(E[i+2])S++; } cout<<an<<endl; }