Contest Duration: - (local time) (300 minutes) Back to Home

Submission #9253193

Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧＿∧
∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
（ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
／　　　＼　 　  |　|
/　　 /￣￣￣￣/　　|
＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, A[10][10];
//---------------------------------------------------------------------------------------------------
int ans = -inf;
vector<int> grp[3];
void dfs(int cu = 0, int tot = 0) {
if (cu == N) {
chmax(ans, tot);
return;
}
rep(g, 0, 3) {
int d = 0;
fore(i, grp[g]) d += A[i][cu];
grp[g].push_back(cu);
dfs(cu + 1, tot + d);
grp[g].pop_back();
}
}
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
rep(i, 0, N) rep(j, i + 1, N) {
cin >> A[i][j];
A[j][i] = A[i][j];
}

dfs();
cout << ans << endl;
}

#### Submission Info

Submission Time 2019-12-31 15:04:28+0900 G - Division hamayanhamayan C++14 (GCC 5.4.1) 6 1927 Byte AC 3 ms 256 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 6 / 6
Status
 AC × 2
 AC × 50
Set Name Test Cases
Sample example_01.txt, example_02.txt
Case Name Status Exec Time Memory
example_01.txt AC 1 ms 256 KB
example_02.txt AC 3 ms 256 KB
subtask_01_01.txt AC 2 ms 256 KB
subtask_01_02.txt AC 2 ms 256 KB
subtask_01_03.txt AC 1 ms 256 KB
subtask_01_04.txt AC 1 ms 256 KB
subtask_01_05.txt AC 2 ms 256 KB
subtask_01_06.txt AC 2 ms 256 KB
subtask_01_07.txt AC 1 ms 256 KB
subtask_01_08.txt AC 1 ms 256 KB
subtask_01_09.txt AC 2 ms 256 KB
subtask_01_10.txt AC 2 ms 256 KB
subtask_01_11.txt AC 1 ms 256 KB
subtask_01_12.txt AC 1 ms 256 KB
subtask_01_13.txt AC 2 ms 256 KB
subtask_01_14.txt AC 2 ms 256 KB
subtask_01_15.txt AC 1 ms 256 KB
subtask_01_16.txt AC 1 ms 256 KB
subtask_01_17.txt AC 2 ms 256 KB
subtask_01_18.txt AC 2 ms 256 KB
subtask_01_19.txt AC 1 ms 256 KB
subtask_01_20.txt AC 1 ms 256 KB
subtask_01_21.txt AC 2 ms 256 KB
subtask_01_22.txt AC 2 ms 256 KB
subtask_01_23.txt AC 1 ms 256 KB
subtask_01_24.txt AC 1 ms 256 KB
subtask_01_25.txt AC 2 ms 256 KB
subtask_01_26.txt AC 2 ms 256 KB
subtask_01_27.txt AC 1 ms 256 KB
subtask_01_28.txt AC 1 ms 256 KB
subtask_01_29.txt AC 2 ms 256 KB
subtask_01_30.txt AC 2 ms 256 KB
subtask_01_31.txt AC 1 ms 256 KB
subtask_01_32.txt AC 1 ms 256 KB
subtask_01_33.txt AC 2 ms 256 KB
subtask_01_34.txt AC 2 ms 256 KB
subtask_01_35.txt AC 1 ms 256 KB
subtask_01_36.txt AC 1 ms 256 KB
subtask_01_37.txt AC 2 ms 256 KB
subtask_01_38.txt AC 2 ms 256 KB
subtask_01_39.txt AC 1 ms 256 KB
subtask_01_40.txt AC 1 ms 256 KB
subtask_01_41.txt AC 2 ms 256 KB
subtask_01_42.txt AC 2 ms 256 KB
subtask_01_43.txt AC 1 ms 256 KB
subtask_01_44.txt AC 2 ms 256 KB
subtask_01_45.txt AC 1 ms 256 KB
subtask_01_46.txt AC 1 ms 256 KB
subtask_01_47.txt AC 2 ms 256 KB
subtask_01_48.txt AC 2 ms 256 KB