結果

問題 No.610 区間賞(Section Award)
ユーザー CleyLCleyL
提出日時 2020-03-18 13:58:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 1,922 ms
コンパイル使用メモリ 88,844 KB
実行使用メモリ 9,296 KB
最終ジャッジ日時 2023-08-20 19:53:11
合計ジャッジ時間 5,442 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 16 ms
4,672 KB
testcase_20 AC 92 ms
9,116 KB
testcase_21 AC 11 ms
4,380 KB
testcase_22 AC 57 ms
7,208 KB
testcase_23 AC 6 ms
4,380 KB
testcase_24 AC 20 ms
4,784 KB
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 39 ms
6,068 KB
testcase_27 AC 89 ms
9,180 KB
testcase_28 AC 77 ms
8,404 KB
testcase_29 AC 54 ms
7,028 KB
testcase_30 AC 73 ms
8,192 KB
testcase_31 AC 35 ms
5,904 KB
testcase_32 AC 83 ms
8,692 KB
testcase_33 AC 11 ms
4,376 KB
testcase_34 AC 91 ms
9,072 KB
testcase_35 AC 39 ms
6,064 KB
testcase_36 AC 87 ms
8,848 KB
testcase_37 AC 70 ms
7,996 KB
testcase_38 AC 17 ms
4,616 KB
testcase_39 AC 94 ms
9,240 KB
testcase_40 AC 93 ms
9,240 KB
testcase_41 AC 94 ms
9,252 KB
testcase_42 AC 93 ms
9,296 KB
testcase_43 AC 93 ms
9,240 KB
testcase_44 AC 128 ms
4,380 KB
testcase_45 AC 154 ms
4,392 KB
testcase_46 AC 157 ms
4,588 KB
testcase_47 AC 76 ms
8,208 KB
testcase_48 AC 70 ms
7,904 KB
testcase_49 AC 77 ms
8,288 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