結果
問題 | No.3067 +10 Seconds Clock |
ユーザー |
|
提出日時 | 2025-03-21 21:39:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 857 bytes |
コンパイル時間 | 2,135 ms |
コンパイル使用メモリ | 192,152 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-21 21:39:53 |
合計ジャッジ時間 | 3,462 ms |
ジャッジサーバーID (参考情報) |
judge7 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool chk[200005]; int n,m,k,x; int t[200005]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> m; for(int i=1;i<n;i++) cin >> t[i]; cin >> k; for(int i=0;i<k;i++) { cin >> x; chk[x] = true; } int res = 0; int cnt = 0; for(int i=1;i<n;i++) { if(chk[i]) cnt+=1; if(m <= t[i]) { int x = ((t[i]-m)/10) + 1; if(cnt < x) { res = -1; break; } //cout << i << ' ' << m << ' ' << t[i] << ' ' << x << ' ' << cnt << '\n'; res += x; cnt-=x; m += (10*x); m -= t[i]; } else { m -= t[i]; } } cout << res << '\n'; return 0; }