結果

問題 No.699 ペアでチームを作ろう2
ユーザー jelljell
提出日時 2018-06-16 19:36:33
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 3,754 bytes
コンパイル時間 1,565 ms
コンパイル使用メモリ 160,092 KB
最終ジャッジ日時 2024-04-27 02:33:54
合計ジャッジ時間 2,075 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:85:34: error: ‘LB’ function uses ‘auto’ type specifier without trailing return type
   85 | template<class T,class U> inline auto LB(T& v,U in){ return lower_bound(v.begin(),v.end(),in); }
      |                                  ^~~~
main.cpp:85:34: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
main.cpp:86:34: error: ‘UB’ function uses ‘auto’ type specifier without trailing return type
   86 | template<class T,class U> inline auto UB(T& v,U in){ return upper_bound(v.begin(),v.end(),in); }
      |                                  ^~~~
main.cpp:86:34: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’

ソースコード

diff #

#include <bits/stdc++.h> 

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<n;(i)++)
#define rep1(i,n) for(int (i)=1;(i)<=n;(i)++)
#define repU(i,bottom,ceiling) for(int (i)=(bottom);(i)<=(ceiling);(i)++)
#define repD(i,ceiling,bottom) for(int (i)=(ceiling);(i)>=(bottom);(i)--)
#define pub push_back
#define pob pop_back
#define prf printf
#define scf scanf
#define vci(v) for(int i=0;i<v.size();i++) cin>>v[i]
#define vco(v) for(int i=0;i<v.size();i++){ cout<<v[i]<<' '; } cout<<endl
#define mkp make_pair
#define fir first
#define sec second
#define clr(a) memset((a),0,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vdb;
typedef vector<vector<double>> vvdb;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<pair<int,int>> vpii;
typedef pair<int,int> pii;

const string Alphabet("abcdefghijklmnopqrstuvwxyz");
const vector<pair<int,int>> Dir={{1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1}};
const long double Pi=3.141592653589793238462643383279502884197;
const long double Napier=2.71828182845904523536;
const int Inf=(int)2e9+1e8;
const int Mod=(int)1e9+7;

template<typename T,typename U>                                                   
inline pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir+r.fir,l.sec+r.sec};                                    
} 

template<typename T,typename U> 
inline pair<T,U> operator-(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir-r.fir,l.sec-r.sec};                                    
} 

template<typename T,typename U>                                                   
inline pair<T,U> operator*(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir*r.fir,l.sec*r.sec};                                    
}

template<typename T> inline T gcd(T a,T b){ if(a%b){ return gcd(b,a%b); }else{ return b; } }
template<typename T> inline T lcm(T a,T b){ return a/gcd(a,b)*b; }

template<typename T> inline T Mpow(T n,T m,T mod){
	long long res=1,pow=n;
	while(m){
		if(m&1) res=(res*pow)%mod;
		pow=(pow*pow)%mod;
		m>>=1;
	}
	return res;
}

pair<int,int> Thre;
vector<int> v;

template<typename T> inline bool judge(T n){ return (Thre.first<=v[n]&&Thre.sec>=v[n]); }

template<typename T> inline T BiS(T bottom,T ceiling,bool thretype){
	T upper=ceiling+thretype;
	T lower=bottom-(!thretype);
	while(upper-lower>1){
		T mid=(upper+lower)/2;
		if(judge(mid)) (thretype?lower:upper)=mid;
		else (thretype?upper:lower)=mid;
	}
	return (thretype?lower:upper);
}

template<class T,class U> inline auto LB(T& v,U in){ return lower_bound(v.begin(),v.end(),in); }
template<class T,class U> inline auto UB(T& v,U in){ return upper_bound(v.begin(),v.end(),in); }

int N;
ll A[14];
vll table;

template<typename T> inline bool v_find(vector<T> v,T object){
  auto itr = find(v.begin(), v.end(), object);
  size_t index = distance( v.begin(), itr );
  if (index != v.size()) { return true; } else { return false; }
}

inline void arrange(vi &used){
	if(used.size()==N){
		ll tem=0;
		rep(i,N/2) tem^=A[used[2*i]]+A[used[2*i+1]];
		table.pub(tem);
		return;
	}
	int i=0;
	while(v_find(used,i)) i++;
	used.pub(i);
	repU(j,i+1,N-1){
		if(v_find(used,j)) continue;
		used.pub(j);
		arrange(used);
		used.pob();
	}
	used.pob();
	return;
}

inline void solve(){
	vi used;
	arrange(used);
	ll res=0;
	while(!table.empty()){
		res=max(res,table.back());
		table.pob();
	}
	cout<<res<<endl;
	return;
}

inline void input(){
	cin>>N;
	rep(i,N) cin>>A[i];
	return;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	input();
	solve();
	return 0;
}



0