結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-21 21:44:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 115 ms / 2,000 ms |
| コード長 | 711 bytes |
| コンパイル時間 | 5,638 ms |
| コンパイル使用メモリ | 333,504 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2025-03-21 21:44:54 |
| 合計ジャッジ時間 | 7,584 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using mint=atcoder::modint998244353;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define int long long
signed main(){
int N,T;cin>>N>>T;
vector<int> t(N-1);for(auto&&e:t)cin>>e;
int K;cin>>K;
vector<int> X(K);for(auto&&e:X)cin>>e,e--;
auto slv=[&](int k)->bool {
vector<bool> st(N);
for(int i=0;i<k;i++)st[X[i]]=1;
int now=T;
for(int i=0;i<N;i++){
if(st[i])now+=10;
if(i!=N-1){
now-=t[i];
}
if(now<=0)return 0;
}
return 1;
};
int l=-1,r=K+1;
while(r-l>1){
int m=(l+r)>>1;
if(slv(m))r=m;
else l=m;
}
if(r==K+1)cout<<-1<<endl;
else cout<<r<<endl;
}