結果

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

ソースコード

diff #

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

int main() {
  int N, T, K;
  cin >> N >> T;
  vector<int> t(N - 1, 0), sum(N, 0);
  for(int i = 0; i < N - 1; i++) {
    cin >> t[i];
    sum[i + 1] = sum[i] + t[i];
  }
  cin >> K;
  vector<int> x(K, 0);
  for(int &o : x) {
    cin >> o;
  }
  bool f = false;
  int tmp = T;
  for(int i = 0; i < K; i++) {
    if(tmp + 10 * i <= sum[x[i]]) {
      f = true;
    }
  }
  if(f) {
    cout << -1 << endl;
    return 0;
  }
  int l = -1, r = K, c = 0;
  while(r - l > 1) {
    c = (l + r) / 2;
    if(tmp + 10 * c <= sum.at(N - 1)) {
      l = c;
    }
    else {
      r = c;
    }
  }
  cout << r << endl;
}
0