結果

問題 No.698 ペアでチームを作ろう
ユーザー ohreitetsu
提出日時 2018-11-28 22:26:22
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 507 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 673 ms
コンパイル使用メモリ 91,512 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2026-03-13 21:20:49
合計ジャッジ時間 19,715 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	vector<int> A(N);
	int i;
	for (i=0;i<N;i++){
		cin>>A[i];
	}
	sort(A.begin(),A.end());
	int Max=0;
	do {
		int s=0;
		for (i=0;i<N/2;i++){
			s+=A[i]^A[i+N/2];
		}
		Max=max(s,Max);
		/*reverse(A.begin()+N/2,A.end());
		s=0;
		for (i=0;i<N/2;i++){
			s+=A[i]^A[i+N/2];
		}
		Max=max(s,Max);
		*/
	}while(next_permutation(A.begin(),A.end()));
	cout<<Max<<endl;
	return 0;
}
0