結果
問題 |
No.610 区間賞(Section Award)
|
ユーザー |
![]() |
提出日時 | 2020-06-07 15:41:39 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 2,025 ms |
コンパイル使用メモリ | 164,832 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 17:30:44 |
合計ジャッジ時間 | 5,344 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.07 15:41:33 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n;cin >> n; vector<int> a(n),b(n); vector<bool> used(n,false); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } int t = n-1; vector<int> ans; for (int i = n-1; i >= 0; i--){ if (used[a[i]-1]) continue; while(!used[a[i]-1]) { used[b[t]-1] = true; t--; } ans.push_back(a[i]); } sort(ans.begin(), ans.end()); for (int i = 0; i < ans.size(); i++) { cout << ans[i] << endl; } return 0; }