結果

問題 No.610 区間賞(Section Award)
ユーザー CleyLCleyL
提出日時 2020-03-18 13:57:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 88,776 KB
実行使用メモリ 9,216 KB
最終ジャッジ日時 2024-05-08 02:17:16
合計ジャッジ時間 9,385 ms
ジャッジサーバーID
(参考情報)
judge1 / 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 2 ms
5,376 KB
testcase_04 AC 2 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 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 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 20 ms
5,376 KB
testcase_20 AC 133 ms
9,216 KB
testcase_21 RE -
testcase_22 AC 89 ms
7,296 KB
testcase_23 AC 10 ms
5,376 KB
testcase_24 AC 25 ms
5,376 KB
testcase_25 AC 6 ms
5,376 KB
testcase_26 RE -
testcase_27 AC 136 ms
9,216 KB
testcase_28 RE -
testcase_29 AC 75 ms
6,912 KB
testcase_30 RE -
testcase_31 AC 44 ms
5,888 KB
testcase_32 AC 119 ms
8,960 KB
testcase_33 RE -
testcase_34 AC 134 ms
9,216 KB
testcase_35 RE -
testcase_36 AC 124 ms
8,960 KB
testcase_37 AC 101 ms
8,064 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 160 ms
5,376 KB
testcase_45 AC 197 ms
5,376 KB
testcase_46 AC 191 ms
5,376 KB
testcase_47 AC 106 ms
8,448 KB
testcase_48 AC 95 ms
7,808 KB
testcase_49 AC 111 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(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