結果

問題 No.607 開通777年記念
ユーザー むらためむらため
提出日時 2019-01-18 08:40:56
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 753 bytes
コンパイル時間 2,206 ms
コンパイル使用メモリ 66,376 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-14 02:09:40
合計ジャッジ時間 2,582 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 18 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  var minus = false
  while true:
    var k = getchar_unlocked()
    if k == '-' : minus = true
    elif k < '0' or k > '9': break
    else: result = 10 * result + k.ord - '0'.ord
  if minus: result *= -1
template times*(n:int,body) = (for _ in 0..<n: body)

let n = scan()
let m = scan()
var A = newSeq[int](n)
m.times:
  for i in 0..<n: A[i] += scan()
  var x = 0
  var y = 1
  var sum = A[x]
  while true:
    if sum == 777 : quit "YES",0
    if y < A.len and sum + A[y] <= 777:
      sum += A[y]
      y += 1
      continue
    if x == y :
      x += 1
      y += 1
      if x >= A.len: break
    sum -= A[x]
    x += 1
echo "NO"


0