結果

問題 No.519 アイドルユニット
ユーザー nmnmnmnmnmnmnm
提出日時 2017-05-28 22:53:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,688 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 91,588 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-03 03:51:18
合計ジャッジ時間 13,170 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
#define MOD 1000000007
ll d[50][50];
unsigned int xor128(void) {
static unsigned int x = 123456789;
static unsigned int y = 362436069;
static unsigned int z = 521288629;
static unsigned int w = 88675123;
unsigned int t;
t = x ^ (x << 11);
x = y; y = z; z = w;
return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}
int main()
{
ll n;
cin>>n;
rep(i,0,n){
rep(j,0,n){
ll a;
cin>>a;
d[i][j] = a;
}
}
ll mx = 0;
rep(i,0,100){
vector<ll> v;
rep(j,0,n){
v.pb(j);
}
rep(j,0,1000){
swap(v[xor128()%n],v[xor128()%n]);
}
ll mx1 = 0;
rep(j,0,100000){
ll a = xor128()%n;
ll b = xor128()%n;
swap(v[a],v[b]);
ll score = 0;
rep(k,0,n/2){
score += d[v[k]][v[k+n/2]];
}
if(score>=mx1){
mx1 = score;
}
else{
swap(v[a],v[b]);
}
}
mx = max(mx,mx1);
}
cout << mx << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0