結果

問題 No.698 ペアでチームを作ろう
ユーザー ciel
提出日時 2018-06-09 18:09:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 395 bytes
コンパイル時間 3,955 ms
コンパイル使用メモリ 61,812 KB
最終ジャッジ日時 2025-01-05 12:09:55
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 TLE * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:12:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         for(int i=0;i<n;i++)scanf("%d",&v[i]);
      |                             ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <vector>
#include <set>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef pair<long long,long long> pll;

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;i+=2)s+=v[i]^v[i+1];
		r=max(s,r);
	}while(next_permutation(v.begin()+1,v.end()));
	printf("%d",r);
}
0