結果

問題 No.2999 Long Long Friedrice
ユーザー friedrice
提出日時 2024-11-24 19:03:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 654 bytes
コンパイル時間 5,129 ms
コンパイル使用メモリ 308,216 KB
実行使用メモリ 13,824 KB
最終ジャッジ日時 2024-12-23 23:31:16
合計ジャッジ時間 51,694 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 16 WA * 2 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
using maxt = atcoder::modint1000000007;

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for(int &o : A) {
		cin >> o;
	}
	vector<int> B(N);
	for(int &o : B) {
		cin >> o;
	}
	int64_t tmp = 1;
	for(int64_t i = 1; i <= N; i++) {
	  tmp *= i;
	}
	int ans = 0;
	while(tmp > 0) {
	  int H = 1;
	  for(int i = 0; i < N; i++) {
	    if(H == A.at(i)) {
	      H += B.at(i);
	    }
	  }
	  ans = max(ans, H);
	  tmp--;
	  next_permutation(A.begin(), A.end());
	  next_permutation(B.begin(), B.end());
	}
	cout << ans << endl;
}
0