結果
問題 | No.698 ペアでチームを作ろう |
ユーザー |
|
提出日時 | 2018-06-11 12:13:36 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 6 ms / 1,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 1,112 ms |
コンパイル使用メモリ | 118,272 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-13 01:12:37 |
合計ジャッジ時間 | 1,618 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;import std.typecons, std.range, std.random, std.math, std.container;import std.numeric, std.bigint, core.bitop, std.bitmanip;void main() {auto N = readln.chomp.to!int;auto A = readln.split.map!(to!long).array;auto dp = new long[](1<<N);auto bits = (1<<N).iota.array;foreach (mask; 0..(1<<N))foreach (i; 0..N)foreach (j; i+1..N)if (!((1<<i)&mask) && !((1<<j)&mask))dp[mask|(1<<i)|(1<<j)] = max(dp[mask|(1<<i)|(1<<j)], dp[mask] + (A[i]^A[j]));dp[(1<<N)-1].writeln;}