結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2018-06-17 01:42:38 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 768 bytes |
コンパイル時間 | 3,163 ms |
コンパイル使用メモリ | 65,792 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 16:28:21 |
合計ジャッジ時間 | 4,150 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 3 WA * 27 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(26, 5) Warning: use `delete(s, first..last)`; delete is deprecated [Deprecated]
ソースコード
import strutils, sequtils, math, algorithm var N, V = stdin.readLine.split.map parseInt cnt = 0 flg: bool proc check = var best = 0 if V.len <= 4: for i in 0 ..< 2 ^ V.len: var pass: bool cnt_s = 0 for j in 0 ..< V.len: if pass: pass = false elif i.toBin(V.len)[j] == '1': cnt_s += V[j] pass = true best = max(best, cnt_s) echo best + cnt quit() proc eat = cnt += V[0] V.delete 0, 1 flg = false while true: check() if V[0] >= V[1]: eat() else: case V[0] + V[2] - (V[1] + V[3]) of 0: if flg: eat() else: V.reverse flg = true of 1 .. int.high: eat() else: V.delete 0 flg = false