結果
問題 | No.982 Add |
ユーザー |
![]() |
提出日時 | 2020-02-11 13:36:23 |
言語 | Nim (1.6.12) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 2,161 bytes |
コンパイル時間 | 3,283 ms |
実行使用メモリ | 3,300 KB |
最終ジャッジ日時 | 2022-11-24 17:21:12 |
合計ジャッジ時間 | 4,693 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,132 KB |
testcase_01 | AC | 2 ms
3,132 KB |
testcase_02 | AC | 2 ms
3,260 KB |
testcase_03 | AC | 2 ms
3,164 KB |
testcase_04 | AC | 2 ms
3,120 KB |
testcase_05 | AC | 2 ms
3,200 KB |
testcase_06 | AC | 2 ms
3,264 KB |
testcase_07 | AC | 3 ms
3,188 KB |
testcase_08 | AC | 3 ms
3,120 KB |
testcase_09 | AC | 2 ms
3,184 KB |
testcase_10 | AC | 3 ms
3,208 KB |
testcase_11 | AC | 2 ms
3,176 KB |
testcase_12 | AC | 2 ms
3,236 KB |
testcase_13 | AC | 2 ms
3,184 KB |
testcase_14 | AC | 2 ms
3,116 KB |
testcase_15 | AC | 2 ms
3,128 KB |
testcase_16 | AC | 2 ms
3,212 KB |
testcase_17 | AC | 3 ms
3,176 KB |
testcase_18 | AC | 1 ms
3,164 KB |
testcase_19 | AC | 1 ms
3,180 KB |
testcase_20 | AC | 2 ms
3,128 KB |
testcase_21 | AC | 2 ms
3,120 KB |
testcase_22 | AC | 2 ms
3,176 KB |
testcase_23 | AC | 2 ms
3,180 KB |
testcase_24 | AC | 3 ms
3,212 KB |
testcase_25 | AC | 2 ms
3,300 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(1, 19) Warning: imported and not used: 'complex' [UnusedImport] /home/judge/data/code/Main.nim(5, 17) Warning: imported and not used: 'strformat' [UnusedImport] /home/judge/data/code/Main.nim(5, 10) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(1, 76) Warning: imported and not used: 'times' [UnusedImport]
ソースコード
import algorithm, complex, macros, math, sequtils, sets, strutils, tables, times when NimMajor == 0 and NimMinor <= 19: import future else: import sugar, strformat macro unpack*(rhs: seq, cnt: static[int]): auto = let v = genSym(); result = quote do:(let `v` = `rhs`;()) when NimMajor == 0 and NimMinor <= 17: for i in 0 ..< cnt: result[0][1].add(quote do:`v`[`i`]) else: for i in 0 ..< cnt: result[1].add(quote do:`v`[`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 or m proc `|=`*(n: var bool, m: bool) = n = n or m proc `&=`*(n: var int, m: int) = n = n and m proc `&=`*(n: var bool, m: bool) = n = n and m proc `^=`*(n: var int, m: int) = n = n xor m proc `^=`*(n: var bool, m: bool) = n = n xor m 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 SomeNumber, m: SomeNumber) = n = min(n, m) proc `>?=`*(n: var SomeNumber, m: SomeNumber) = 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))) proc newSeq4*[T](n1, n2, n3, n4: Natural): seq[seq[seq[seq[T]]]] = newSeqWith(n1, newSeqWith(n2, newSeqWith(n3, newSeq[T](n4)))) # -------------------------------------------------- # let (A, B) = input(int, 2) if gcd(A, B) != 1: echo "-1" else: var cnt = newSeq[int](A * B + 1) for i in 0 .. 500: for j in 0 .. 500: if A * i + B * j > A * B: continue cnt[A * i + B * j] += 1 var res = 0 for i in 0 .. A * B: if cnt[i] == 0: inc res echo res