結果
問題 | No.90 品物の並び替え |
ユーザー | nanae |
提出日時 | 2017-03-04 03:20:45 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 39 ms / 5,000 ms |
コード長 | 771 bytes |
コンパイル時間 | 849 ms |
コンパイル使用メモリ | 109,964 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-03 01:42:00 |
合計ジャッジ時間 | 1,466 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 5 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 5 ms
4,380 KB |
testcase_06 | AC | 5 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,384 KB |
testcase_08 | AC | 1 ms
4,384 KB |
testcase_09 | AC | 39 ms
4,376 KB |
ソースコード
import std.stdio, std.string, std.conv, std.array, std.algorithm; import std.uni, std.range, std.math, std.container, std.datetime; import core.bitop; immutable long MOD = 1_000_000_007; void main(){ char[] buf; readln(buf); auto input = buf.split.to!(int[]); auto N = input[0], M = input[1]; auto st = new int[][](N, N); foreach(i ; 0 .. M){ readln(buf); input = buf.split.to!(int[]); auto a = input[0], b = input[1], score = input[2]; st[a][b] = score; } int ans; foreach(p ; iota(N).permutations){ int tmp; foreach(i ; 0 .. N){ foreach(j ; i + 1 .. N){ tmp += st[p[i]][p[j]]; } } ans = max(tmp, ans); } writeln(ans); }