結果

問題 No.989 N×Mマス計算(K以上)
コンテスト
ユーザー dot_haraai
提出日時 2021-03-31 20:15:09
言語 Nim
(2.2.12 + ACL)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
WJ  
(最新)
AC  
(最初)
実行時間 -
コード長 999 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
最終ジャッジ日時 2026-10-15 18:01:56
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)

ソースコード

diff #
raw source code

import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets
import critbits, future, strformat, deques
template `max=`(x,y) = x = max(x,y)
template `min=`(x,y) = x = min(x,y)
template `mod=`(x,y) = x = x mod y
template scan2 = (scan(), scan())
template scan3 = (scan(), scan())
let read* = iterator: string {.closure.} =
    while true: (for s in stdin.readLine.split: yield s)
proc scan(): int = read().parseInt
proc scanf(): float = read().parseFloat
proc toInt(c:char): int =
    return int(c) - int('0')



proc solve():int=
  var
    n = scan()
    m = scan()
    k = scan()
    op = read()
    b = newseqwith(m,scan()).sorted(SortOrder.Ascending)
    a = newseqwith(n,scan()).sorted(SortOrder.Descending)
    aidx=0
  
  if op=="*":
    for bidx in 0..<m:
      while aidx<n and a[aidx]*b[bidx]>=k:
        aidx+=1
      result+=aidx
  else:
    for bidx in 0..<m:
      while aidx<n and a[aidx]+b[bidx]>=k:
        aidx+=1
      result+=aidx
      
      

  
echo solve()
0