今日はいろいろなものがうまく行かない。
Hades は弓でクリアし、すべての武器で一周ずつした。
- PAST #1 G - 組分け (第一回 アルゴリズム実技検定 G問題)
https://atcoder.jp/contests/past201912-open/tasks/past201912_g
- https://atcoder.jp/contests/past201912-open/submissions/40962817
- 初期値を 0 にしてしまい、 6WA
- 310 程度しかないので全探索すれば良い
use proconio::input; fn f(max: &mut i64, n: usize, a: &Vec<Vec<i64>>, group: &mut Vec<usize>, i: usize) { if i == n { let mut sum = 0_i64; for i in 0..n { for j in 0..n { if i == j || group[i] != group[j] { continue; } sum += a[i][j]; } } *max = (*max).max(sum); return; } for k in 0..3 { group.push(k); f(max, n, a, group, i + 1); group.pop(); } } fn main() { input! { n: usize, } let mut a = vec![vec![0_i64; n]; n]; for i in 0..n { for j in i + 1..n { input! { a_ij: i64, } a[i][j] = a_ij; } } let mut ans = -(1_i64 << 60); let mut group = vec![]; f(&mut ans, n, &a, &mut group, 0); println!("{}", ans); }
今日のコミット。
- tsukota 1 commit
- rust-atcoder 1 commit