結果

問題 No.647 明太子
ユーザー むらためむらため
提出日時 2018-12-18 04:46:59
言語 Nim
(2.0.2)
結果
RE  
実行時間 -
コード長 693 bytes
コンパイル時間 2,875 ms
コンパイル使用メモリ 69,148 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-13 21:41:53
合計ジャッジ時間 4,721 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 2 ms
4,376 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 1 ms
4,380 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport]
/home/judge/data/code/Main.nim(1, 54) Warning: imported and not used: 'strformat' [UnusedImport]
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport]
/home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,algorithm,math,sugar,macros,strformat
template get*():string = stdin.readLine().strip()
macro unpack*(arr: auto,cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `arr`;())
  for i in 0..<cnt: result[1].add(quote do:`t`[`i`])

let n = get().parseInt
let AB = newSeqWith(n,get().split().map(parseInt).unpack(2))
# A円以内 B辛以上
let m = get().parseInt
let XY = newSeqWith(n,get().split().map(parseInt).unpack(2))
# X円 Y辛
var res = newSeq[int](m)
for i,xy in XY:
  for ab in AB:
    if ab[0] >= xy[0] and ab[1] <= xy[1] :
      res[i] += 1
let maxRes = res.max()
if maxRes == 0: quit("0",0)
for i,r in res:
  if r == maxRes: echo i + 1
0