結果
問題 |
No.3086 Re One Two
|
ユーザー |
|
提出日時 | 2025-04-03 22:07:53 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 1,869 ms |
コンパイル使用メモリ | 92,348 KB |
実行使用メモリ | 19,008 KB |
最終ジャッジ日時 | 2025-04-03 22:08:02 |
合計ジャッジ時間 | 8,292 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | TLE * 1 -- * 2 |
other | -- * 32 |
ソースコード
#include<iostream> #include<vector> #include<stack> using namespace std; using ll = long long; int main(){ int N; cin >> N; vector<bool> lock(N,0); vector<int> to(N,-1); int two = -1; for(int i = 0; i < N; i++){ int A,B; cin >> A >> B; if(A == 1){ lock[i] = 1; to[i+1] = i; } if(B == 1){ to[i] = two; } if(B == 2){ lock[i] = 1; two = i; } } stack<int> sta; for(int i = 0; i < N; i++){ if(!lock[i]){ sta.push(i); while(sta.size()){ int now = sta.top(); cout << now + 1 << endl; if(to[now] != -1)sta.push(to[now]); } } } return 0; }