結果

問題 No.3067 +10 Seconds Clock
ユーザー sai
提出日時 2025-03-21 21:39:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 3,691 ms
コンパイル使用メモリ 276,172 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-21 21:39:08
合計ジャッジ時間 4,845 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, t;
  std::cin >> n >> t;
  std::vector<int> T(n - 1);
  for (int i = 0; i + 1 < n; i++) {
    std::cin >> T[i];
  }
  int k;
  std::cin >> k;
  std::vector<bool> clock(n, false);
  for (int i = 0; i < k; i++) {
    int x;
    std::cin >> x;
    x--;
    clock[x] = true;
  }
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    t -= T[i - 1];
    while (t <= 0) {
      if (cnt > 0) {
        cnt--;
        t += 10;
      } else {
        std::cout << "-1\n";
        return 0;
      }
    }
    if (i + 1 == n) {
      std::cout << k - cnt << '\n';
      return 0;
    }
    cnt += (clock[i]);
  }
}
0