結果
| 問題 | 
                            No.90 品物の並び替え
                             | 
                    
| コンテスト | |
| ユーザー | 
                             toshiro_yanagi
                         | 
                    
| 提出日時 | 2019-01-06 11:01:43 | 
| 言語 | Nim  (2.2.0)  | 
                    
| 結果 | 
                             
                                CE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 858 bytes | 
| コンパイル時間 | 881 ms | 
| コンパイル使用メモリ | 70,196 KB | 
| 最終ジャッジ日時 | 2024-11-14 20:45:13 | 
| 合計ジャッジ時間 | 1,232 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(26, 15) Error: undeclared identifier: 'lc'
ソースコード
import sugar, strutils, tables
from algorithm import nextPermutation
proc nextString: string =
  result = ""
  while not endOfFile stdin:
    let nextChar = readChar stdin
    case nextChar
    of '\r':
      discard
    of "\n"[0], ' ':
      break
    else:
      add result, nextChar
proc nextInt: int =
  parseInt nextString()
proc main: void =
  let n, m = nextInt()
  var ans = 0
  var items = lc[j | (j <- 0 ..< n), int]
  var scoreDic = initTable[tuple[item1, item2: int], int]()
  for i in 0 ..< m:
    scoreDic[(nextInt(), nextInt())] = nextInt()
  while true:
    var score = 0
    for j in 0 ..< n:
      for i in 0 ..< j:
        try:
          score += scoreDic[(items[i], items[j])]
        except:
          discard
    ans = max(ans, score)
    if not items.nextPermutation:
      break
  echo ans
when isMainModule:
  main()
            
            
            
        
            
toshiro_yanagi