結果

問題 No.3067 +10 Seconds Clock
ユーザー tobbie
提出日時 2025-04-07 14:27:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 194,800 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-07 14:27:55
合計ジャッジ時間 5,040 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

int main() {
  int n, t;
  cin >> n >> t;
  vector<int> ti(n-1), xi(n-1, 0);
  rep(i, n-1) cin >> ti[i];
  int k;
  cin >> k;
  rep(i, k) {
    int x; cin >> x;
    xi[x-1] = 10;
  }
  t -= ti[0];
  int cnt = 0;
  rep(i, n-2) {
    if (t - ti[i+1] <= 0) {
      t += xi[i];
      cnt++;
    }
    t -= ti[i+1];
    if (t < 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << cnt << endl;
  return 0;
}
0