結果

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

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO                \
  ios::sync_with_stdio(false); \
  cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;

int main() {
  FAST_IO
  auto ans = 0LL;

  int N,T;
  cin >> N >> T;
  vector<i64> t(N-1);
  for (auto& x : t) cin >> x;

  int K;
  cin >> K;
  vector<int> x(N);
  for (auto& y : x) cin >> y;


  vector<bool> x2(N);
  for (int i = 0; i < K; i ++) {
    x2[x[i]-1] = true;
  }

  i64 cur = 0;
  i64 tm = 0;
  for (int i = 0; i < N-1; i ++) {
    if (T + tm * 10 < t[i]) {
      ans = -1;
      break;
    }
    T -= t[i];
    if (T < 0) {
      auto t = (abs(T) + 9) / 10;
      cur += t * 10;
      tm -= t;
      ans += t;
    }
    if (x2[i-1]) {
      tm ++;
    }
  }


  cout << ans << endl;
}
0