結果

問題 No.455 冬の大三角
ユーザー むらためむらため
提出日時 2019-01-19 18:31:51
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,089 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 63,980 KB
最終ジャッジ日時 2023-09-14 02:19:25
合計ジャッジ時間 1,735 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 28) Error: cannot open file: queues

ソースコード

diff #

import sequtils,strutils,algorithm,math,sugar,macros,strformat
import sets,tables,intsets,queues,heapqueue,bitops
type Pos = tuple[x,y:int]
proc putchar_unlocked(c:char){. importc:"putchar_unlocked",header: "<stdio.h>" .}
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    var k = getchar_unlocked()
    if k < '0': break
    result = 10 * result + k.ord - '0'.ord
let h = scan()
let w = scan()
proc get():(Pos,Pos)=
  var a : Pos
  var aIsAlready = false
  for y in 0..<h:
    for x in 0..<w:
      if getchar_unlocked() != '*': continue
      if aIsAlready: return (a,(x,y))
      a = (x,y)
      aIsAlready = true
    discard getchar_unlocked()
let (a,b) = get()
var c:Pos
if a.x == b.x:
  if a.x == 0: c = (1,a.y)
  else: c = (a.x-1,a.y)
else:
  if a.y == 0: c = (a.x,1)
  else:c = (a.x,a.y-1)
proc encode(p:Pos):int = p.x + p.y * w
let codes = [a,b,c].map(encode)
var i = 0
for y in 0..<h:
  for x in 0..<w:
    if i in codes: putchar_unlocked('*')
    else: putchar_unlocked('-')
    i += 1
  putchar_unlocked('\n')
0