結果
| 問題 | 
                            No.90 品物の並び替え
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-08-30 10:25:16 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 627 bytes | 
| コンパイル時間 | 721 ms | 
| コンパイル使用メモリ | 124,436 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 03:50:38 | 
| 合計ジャッジ時間 | 3,009 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 1 WA * 8 | 
ソースコード
import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv, std.bigint, std.math, std.random;
import std.stdio, std.typecons;
alias Tuple!(int, "i1", int, "i2", int, "sc") row;
void main()
{
  auto rd = readln.split.map!(to!int);
  auto n = rd[0];
  auto m = rd[1];
  auto tbl = iota(m).map!((_) {
    auto rd = readln.split.map!(to!int);
    return row(rd[0] - 1, rd[1] - 1, rd[2]);
  }).array;
  auto max = 0;
  foreach (ai; iota(n).permutations) {
    auto r = tbl.map!(row => ai.find(row.i1).length > ai.find(row.i2).length ? row.sc : 0).sum;
    if (r > max) max = r;
  }
  writeln(max);
}