結果
問題 | No.3067 +10 Seconds Clock |
ユーザー |
|
提出日時 | 2025-03-21 21:52:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 123 ms / 2,000 ms |
コード長 | 757 bytes |
コンパイル時間 | 3,396 ms |
コンパイル使用メモリ | 280,420 KB |
実行使用メモリ | 14,616 KB |
最終ジャッジ日時 | 2025-03-21 21:52:06 |
合計ジャッジ時間 | 5,297 ms |
ジャッジサーバーID (参考情報) |
judge7 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int N, T; cin >> N >> T; vector<int> t(N - 1); for(auto& e: t) cin >> e; int K; cin >> K; set<int> Xs; for(int i = 0; i < K; i++) { int x; cin >> x; Xs.insert(x); } vector<int> st; int ans = 0; for(int i = 0; i < N - 1; i++) { if(Xs.find(i + 1) != Xs.end()) st.push_back(i); while(!st.empty() && T - t[i] <= 0) { ans++; st.pop_back(); T += 10; } T -= t[i]; if(T <= 0) { cout << -1 << endl; return 0; } } cout << ans << endl; }