結果

問題 No.698 ペアでチームを作ろう
ユーザー cielciel
提出日時 2018-06-10 01:50:31
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 374 ms / 1,000 ms
コード長 377 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 86,572 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-20 10:46:34
合計ジャッジ時間 4,225 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 15 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 372 ms
4,380 KB
testcase_08 AC 371 ms
4,380 KB
testcase_09 AC 369 ms
4,380 KB
testcase_10 AC 370 ms
4,380 KB
testcase_11 AC 374 ms
4,380 KB
testcase_12 AC 370 ms
4,380 KB
testcase_13 AC 374 ms
4,380 KB
testcase_14 AC 370 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int n,r=0;
	scanf("%d",&n);
	vector<int> v(n);
	for(int i=0;i<n;i++)scanf("%d",&v[i]);
	sort(v.begin(),v.end());
	do{
		int s=0;
		for(int i=0;i<n/2;i++)s+=v[i]^v[i+n/2];
		r=max(s,r);
		reverse(v.begin()+n/2,v.end());
	}while(next_permutation(v.begin(),v.end()));
	printf("%d\n",r);
}
0