結果
| 問題 |
No.610 区間賞(Section Award)
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2020-03-18 13:57:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 938 ms |
| コンパイル使用メモリ | 88,904 KB |
| 実行使用メモリ | 9,216 KB |
| 最終ジャッジ日時 | 2024-12-14 01:49:40 |
| 合計ジャッジ時間 | 8,466 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 RE * 12 |
ソースコード
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;cin>>n;
int a[n],b[n];
for(int i = 0; n > i; i++){
cin>>a[i];
}
for(int i = 0; n > i; i++){
cin>>b[i];
}
queue<int> Z;
set<int> A;
vector<int> ans;
for(int i = n-1; 0 <= i; i--){
Z.push(a[i]);
if((Z.size()&&Z.front()==b[i])){
ans.push_back(b[i]);
Z.pop();
while(A.find(Z.front())!=A.end())Z.pop();
}else{
A.insert(b[i]);
}
}
sort(ans.begin(),ans.end());
for(int i = 0; ans.size() > i; i++){
cout << ans[i] << endl;
}
}