結果

問題 No.2999 Long Long Friedrice
ユーザー daiotadaiota
提出日時 2024-12-24 02:00:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 597 bytes
コンパイル時間 1,748 ms
コンパイル使用メモリ 170,960 KB
実行使用メモリ 18,080 KB
最終ジャッジ日時 2024-12-24 02:00:16
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
17,408 KB
testcase_01 AC 5 ms
17,280 KB
testcase_02 AC 5 ms
17,280 KB
testcase_03 AC 5 ms
17,536 KB
testcase_04 AC 6 ms
17,408 KB
testcase_05 AC 6 ms
17,408 KB
testcase_06 AC 5 ms
17,664 KB
testcase_07 AC 6 ms
17,664 KB
testcase_08 AC 5 ms
17,664 KB
testcase_09 AC 6 ms
17,536 KB
testcase_10 AC 5 ms
17,536 KB
testcase_11 AC 5 ms
17,408 KB
testcase_12 AC 4 ms
17,408 KB
testcase_13 AC 4 ms
17,408 KB
testcase_14 AC 5 ms
17,536 KB
testcase_15 AC 5 ms
17,408 KB
testcase_16 AC 5 ms
17,408 KB
testcase_17 AC 6 ms
17,536 KB
testcase_18 AC 5 ms
17,408 KB
testcase_19 AC 5 ms
17,536 KB
testcase_20 AC 5 ms
17,408 KB
testcase_21 AC 5 ms
17,408 KB
testcase_22 AC 5 ms
17,408 KB
testcase_23 AC 5 ms
17,408 KB
testcase_24 RE -
testcase_25 AC 7 ms
17,408 KB
testcase_26 AC 9 ms
17,408 KB
testcase_27 AC 6 ms
17,408 KB
testcase_28 AC 5 ms
17,408 KB
testcase_29 AC 5 ms
17,536 KB
testcase_30 AC 5 ms
17,408 KB
testcase_31 AC 5 ms
17,536 KB
testcase_32 AC 5 ms
17,536 KB
testcase_33 AC 5 ms
17,408 KB
testcase_34 AC 5 ms
17,408 KB
testcase_35 AC 4 ms
17,536 KB
testcase_36 AC 5 ms
17,280 KB
testcase_37 AC 5 ms
17,408 KB
testcase_38 AC 6 ms
17,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)




ll a[2010],b[2010];
ll v[600010];
vector<ll> g[600010];
ll T=1;

void dfs(ll x){

	v[x]=1;
	T=max(T,x);

	for(ll i=0;i<(ll)g[x].size();i++){
		if(v[g[x][i]]==0){
			dfs(g[x][i]);
		}
	}



}




int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	ll i,j;


	ll N;
	cin >> N;

	for(i=1;i<=N;i++) cin >> a[i];
	for(i=1;i<=N;i++) cin >> b[i];

	for(i=1;i<=N;i++) g[a[i]].push_back(a[i]+b[i]);


	dfs(1);


	cout << T << endl;




	return 0;
}
0