AtCoder Grand Contest 018

Submission #6371339

Source codeソースコード

import algorithm, future, macros, math, sequtils, sets, strutils, tables

macro unpack(rhs: seq, cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `rhs`;())
  if NimMinor <= 17:
    for i in 0..<cnt: result[0][1].add(quote do:`t`[`i`])
  else:
    for i in 0..<cnt: result[1].add(quote do:`t`[`i`])

template input(T: typedesc, cnt: Natural = 1): untyped =
  let line = stdin.readLine.split(" ")
  when T is int:         line.map(parseInt).unpack(cnt)
  elif T is float:       line.map(parseFloat).unpack(cnt)
  elif T is string:      line.unpack(cnt)
  elif T is char:        line.mapIt(it[0]).unpack(cnt)
  elif T is seq[int]:    line.map(parseint)
  elif T is seq[float]:  line.map(parseFloat)
  elif T is seq[string]: line
  elif T is seq[char]:   line.mapIt(it[0])

proc `%=`(n: var int, m: int)  = n = n mod m
proc `//=`(n: var int, m: int) = n = n div m
proc `<<=`(n: var int, m: int) = n = n shl m
proc `>>=`(n: var int, m: int) = n = n shr m
proc `<?=`(n: var int, m: int) = n = min(n, m)
proc `>?=`(n: var int, m: int) = n = max(n, m)
proc newSeq2[T](n1, n2: Natural): seq[seq[T]] = newSeqWith(n1, newSeq[T](n2))
proc newSeq3[T](n1, n2, n3: Natural): seq[seq[seq[T]]] = newSeqWith(n1, newSeqWith(n2, newSeq[T](n3)))

# -------------------------------------------------- #

var (N, K) = input(int, 2)
var A = @[0] & input(seq[int]).sorted(cmp)
var allgcd = 0
for i in 1 .. N:
  allgcd = gcd(allgcd, A[i])
if K mod allgcd == 0 and K <= max(A):
  echo "POSSIBLE"
else:
  echo "IMPOSSIBLE"

Submission

Task問題 A - Getting Difference
User nameユーザ名 nadeshino
Created time投稿日時
Language言語 Nim (0.13.0)
Status状態 AC
Score得点 300
Source lengthソースコード長 1559 Byte
File nameファイル名
Exec time実行時間 70 ms
Memory usageメモリ使用量 9612 KB

Compiler messageコンパイルメッセージ

Hint: system [Processing]
Hint: Main [Processing]
Hint: algorithm [Processing]
Hint: future [Processing]
Hint: macros [Processing]
Hint: math [Processing]
Hint: times [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: sequtils [Processing]
Hint: sets [Processing]
Hint: os [Processing]
Hint: posix [Processing]
Hint: hashes [Processing]
Hint: etcpriv [Processing]
Hint: tables [Processing]
Main.nim(24, 6) Hint: 'Main.>>=(n: var int, m: int)' is declared but not used [XDeclaredButNotUsed]
Main.nim(28, 6) Hint: 'Main.newSeq3(n1: Natural, n2: Natural, n3: Natural)' is declared but not used [XDeclaredButNotUsed]
Main.nim(25, 6) Hint: 'Main.<?=(n: var int, m: int)' is declared but not used [XDeclaredButNotUsed]
Main.nim(23, 6) Hint: 'Main.<<=(n: var int, m: int)' is declared but not used [XDeclaredButNotUsed]
Main.nim(27, 6) Hint: 'Main.newSeq2(n1: Natural, n2: Natural)' is declared but not used [XDeclaredButNotUsed]
Main.nim(26, 6) Hint: 'Main.>?=(n: var int, m: int)' is declared but not us...

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt,sample_04.txt
All 300 / 300 sample_01.txt,sample_02.txt,sample_03.txt,sample_04.txt,sample_01.txt,sample_02.txt,sample_03.txt,sample_04.txt,subtask_1_01.txt,subtask_1_02.txt,subtask_1_03.txt,subtask_1_04.txt,subtask_1_05.txt,subtask_1_06.txt,subtask_1_07.txt,subtask_1_08.txt,subtask_1_09.txt,subtask_1_10.txt,subtask_1_11.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 256 KB
subtask_1_03.txt AC 70 ms 9612 KB
subtask_1_04.txt AC 56 ms 8844 KB
subtask_1_05.txt AC 30 ms 4732 KB
subtask_1_06.txt AC 10 ms 1660 KB
subtask_1_07.txt AC 41 ms 5372 KB
subtask_1_08.txt AC 62 ms 8972 KB
subtask_1_09.txt AC 28 ms 4476 KB
subtask_1_10.txt AC 50 ms 7820 KB
subtask_1_11.txt AC 56 ms 8332 KB