結果
| 問題 |
No.3067 +10 Seconds Clock
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2025-03-22 02:12:17 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 695 bytes |
| コンパイル時間 | 7,834 ms |
| コンパイル使用メモリ | 274,832 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-22 02:12:26 |
| 合計ジャッジ時間 | 5,837 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n,t;
cin>>n>>t;
V<int> T(n-1);
rep(i,n-1) cin>>T[i];
int k;
cin>>k;
V<int> X(n);
rep(i,k){
int x;
cin>>x;
x--;
X[x]=1;
}
int ans=0,res=0;
rep(i,n-1){
if(X[i]) res++;
while(res && t-T[i]<=0){
ans++;
res--;
t+=10;
}
if(t-T[i]<=0){
cout<<-1<<endl;
return 0;
}
t-=T[i];
}
cout<<ans<<endl;
return 0;
}
umezo