結果

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

ソースコード

diff #

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,t;
  cin>>n>>t;
  V<int> T(n-1);
  rep(i,n-1) cin>>T[i];
  int k;
  cin>>k;
  V<int> X(n);
  rep(i,k){
    int x;
    cin>>x;
    x--;
    X[x]=1;
  }
  int ans=0,res=0;
  rep(i,n-1){
    while(res && t-T[i]<=0){
      ans++;
      res--;
      t+=10;
    }
    if(t-T[i]<=0){
      cout<<-1<<endl;
      return 0;
    }
    t-=T[i];
    if(X[i]) res++;
  }
  cout<<ans<<endl;
  
  return 0;
}
0