結果
問題 | No.519 アイドルユニット |
ユーザー | nebukuro09 |
提出日時 | 2017-05-28 22:18:51 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,225 bytes |
コンパイル時間 | 701 ms |
コンパイル使用メモリ | 111,792 KB |
実行使用メモリ | 4,504 KB |
最終ジャッジ日時 | 2023-09-03 13:39:44 |
合計ジャッジ時間 | 11,668 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 258 ms
4,376 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 350 ms
4,376 KB |
testcase_05 | AC | 307 ms
4,376 KB |
testcase_06 | AC | 288 ms
4,376 KB |
testcase_07 | AC | 279 ms
4,376 KB |
testcase_08 | AC | 274 ms
4,376 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 549 ms
4,380 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 262 ms
4,376 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 351 ms
4,376 KB |
ソースコード
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; void main() { auto N = readln.chomp.to!int; auto A = N.iota.map!(_ => readln.split.map!(to!int).array).array; auto used = new bool[](N); auto tied = new int[](N); int point = 0; foreach (i; 0..N/2) { int x, y; do { x = uniform(0, N); } while (used[x]); used[x] = true; do { y = uniform(0, N); } while (used[y]); used[y] = true; tied[x] = y; tied[y] = x; } foreach (_; 0..5*10^^6) { int x, y; do { x = uniform(0, N); y = uniform(0, N); } while (x == y); int xx = tied[x]; int yy = tied[y]; if (A[x][xx] + A[y][yy] < A[x][y] + A[xx][yy]) { tied[x] = y; tied[y] = x; tied[xx] = yy; tied[yy] = xx; } } point = 0; fill(used, false); foreach (i; 0..N) { if (!used[i]) point += A[i][tied[i]]; used[i] = used[tied[i]] = true; } point.writeln; }