結果

問題 No.610 区間賞(Section Award)
ユーザー CleyLCleyL
提出日時 2020-03-18 13:58:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 1,167 ms
コンパイル使用メモリ 88,692 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2024-05-08 02:17:21
合計ジャッジ時間 5,514 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 18 ms
5,376 KB
testcase_20 AC 104 ms
9,216 KB
testcase_21 AC 13 ms
5,376 KB
testcase_22 AC 65 ms
7,168 KB
testcase_23 AC 8 ms
5,376 KB
testcase_24 AC 23 ms
5,376 KB
testcase_25 AC 6 ms
5,376 KB
testcase_26 AC 45 ms
6,144 KB
testcase_27 AC 106 ms
9,088 KB
testcase_28 AC 89 ms
8,448 KB
testcase_29 AC 62 ms
7,040 KB
testcase_30 AC 79 ms
8,192 KB
testcase_31 AC 39 ms
6,016 KB
testcase_32 AC 91 ms
8,832 KB
testcase_33 AC 11 ms
5,376 KB
testcase_34 AC 101 ms
9,216 KB
testcase_35 AC 43 ms
6,272 KB
testcase_36 AC 100 ms
8,960 KB
testcase_37 AC 83 ms
8,064 KB
testcase_38 AC 20 ms
5,376 KB
testcase_39 AC 105 ms
9,344 KB
testcase_40 AC 106 ms
9,344 KB
testcase_41 AC 107 ms
9,344 KB
testcase_42 AC 106 ms
9,344 KB
testcase_43 AC 103 ms
9,344 KB
testcase_44 AC 148 ms
5,376 KB
testcase_45 AC 174 ms
5,376 KB
testcase_46 AC 180 ms
5,376 KB
testcase_47 AC 87 ms
8,320 KB
testcase_48 AC 82 ms
7,936 KB
testcase_49 AC 87 ms
8,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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(!Z.empty()&&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;
	}
}
0