結果
| 問題 |
No.1360 [Zelkova 4th Tune] 協和音
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-23 02:43:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,084 bytes |
| コンパイル時間 | 3,559 ms |
| コンパイル使用メモリ | 198,276 KB |
| 最終ジャッジ日時 | 2025-01-18 07:11:29 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 44 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
vector<ll> a(n);
for(int i=0;i<n;i++){
cin >> a[i];
}
vector<vector<ll>> b(n,vector<ll>(n));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin >> b[i][j];
}
}
ll res=0;
int id=0;
for(int i=1;i<(1<<n);i++){
ll sum=0;
for(int j=0;j<n;j++){
if((1<<j)&i){
sum+=a[j];
for(int k=j+1;k<n;k++){
if((1<<k)&i){
sum+=b[j][k];
}
}
}
}
if(sum>res){
res=sum;
id=i;
}
}
cout << res << endl;
for(int i=0;i<n;i++){
if((1<<i)&id){
cout << i+1 << " ";
}
}
cout << endl;
}