結果
問題 |
No.3067 +10 Seconds Clock
|
ユーザー |
|
提出日時 | 2025-03-21 21:44:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 815 bytes |
コンパイル時間 | 3,601 ms |
コンパイル使用メモリ | 281,240 KB |
実行使用メモリ | 14,364 KB |
最終ジャッジ日時 | 2025-03-21 21:44:13 |
合計ジャッジ時間 | 5,551 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 1 |
ソースコード
#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(T - t[i] <= 0) { while(!st.empty() && T - t[i] <= 0) { ans++; st.pop_back(); T += 10; } } T -= t[i]; if(T <= 0) { cout << -1 << endl; return 0; } if(Xs.find(i + 1) != Xs.end()) st.push_back(i); } cout << ans << endl; }