結果

問題 No.610 区間賞(Section Award)
ユーザー lyozlyoz
提出日時 2017-12-10 00:40:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 2,158 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 204,756 KB
実行使用メモリ 8,796 KB
最終ジャッジ日時 2023-08-20 05:44:28
合計ジャッジ時間 4,866 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 19 ms
4,388 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 13 ms
4,380 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 6 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 10 ms
4,376 KB
testcase_27 AC 18 ms
4,380 KB
testcase_28 AC 17 ms
4,380 KB
testcase_29 AC 12 ms
4,376 KB
testcase_30 AC 16 ms
4,384 KB
testcase_31 AC 9 ms
4,380 KB
testcase_32 AC 18 ms
4,380 KB
testcase_33 AC 4 ms
4,380 KB
testcase_34 AC 19 ms
4,384 KB
testcase_35 AC 10 ms
4,376 KB
testcase_36 AC 18 ms
4,380 KB
testcase_37 AC 16 ms
4,376 KB
testcase_38 AC 5 ms
4,380 KB
testcase_39 AC 19 ms
4,376 KB
testcase_40 AC 19 ms
4,516 KB
testcase_41 AC 19 ms
4,376 KB
testcase_42 AC 19 ms
4,380 KB
testcase_43 AC 19 ms
4,376 KB
testcase_44 AC 51 ms
7,728 KB
testcase_45 AC 60 ms
8,772 KB
testcase_46 AC 60 ms
8,796 KB
testcase_47 AC 16 ms
4,380 KB
testcase_48 AC 15 ms
4,380 KB
testcase_49 AC 16 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi a(n),b(n);
		rep(i,n) cin>>a[i],a[i]--;
		rep(i,n) cin>>b[i],b[i]--;

		vi f(n);
		rep(i,n) f[a[i]]=i;

		set<int> res;
		int x=-1;
		for(int i:b) if(chmax(x,f[i])) res.insert(i);
		for(int x:res) cout<<x+1<<endl;
	}
}
0