結果

問題 No.1133 キムワイプイーター
ユーザー scrappyscrappy
提出日時 2022-10-13 11:42:39
言語 Go
(1.22.1)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 15,537 ms
コンパイル使用メモリ 213,896 KB
実行使用メモリ 5,480 KB
最終ジャッジ日時 2023-09-08 19:01:52
合計ジャッジ時間 15,347 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 37 ms
4,376 KB
testcase_03 AC 95 ms
5,472 KB
testcase_04 AC 84 ms
5,472 KB
testcase_05 AC 100 ms
5,476 KB
testcase_06 AC 68 ms
5,472 KB
testcase_07 AC 81 ms
4,380 KB
testcase_08 AC 89 ms
4,376 KB
testcase_09 AC 39 ms
5,472 KB
testcase_10 AC 41 ms
5,480 KB
testcase_11 AC 67 ms
5,476 KB
testcase_12 AC 91 ms
5,472 KB
testcase_13 AC 54 ms
5,476 KB
testcase_14 AC 6 ms
5,464 KB
testcase_15 AC 27 ms
4,376 KB
testcase_16 AC 60 ms
4,376 KB
testcase_17 AC 43 ms
4,380 KB
testcase_18 AC 107 ms
4,380 KB
testcase_19 AC 39 ms
4,376 KB
testcase_20 AC 84 ms
4,376 KB
testcase_21 AC 107 ms
4,376 KB
testcase_22 AC 112 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 39 ms
4,384 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 116 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1000000+2), 1000000+2)

	sc.Scan()
	ss := strings.Fields(sc.Text())
	n, _ := strconv.Atoi(ss[0])
	//m, _ := strconv.Atoi(ss[1])

	sc.Scan()
	s := sc.Text()

	mm := make([][]bool, 1+n)
	for b := 0; b <= n; b++ {
		mm[b] = make([]bool, 1+n)
	}

	a, b := 0, 0
	mm[b][a] = true // ate
	for _, c := range s {
		switch c {
		case 'U':
			b++
		case 'R':
			a++
		case 'L':
			a--
		case 'D':
			b--
		}
		mm[b][a] = true // ate
	}

	for b := n; b >= 0; b-- {
		for a := 0; a <= n; a++ {
			if mm[b][a] {
				fmt.Print(0)
			} else {
				fmt.Print(1)
			}

			if a < n {
				fmt.Print(" ")
			} else {
				fmt.Println()
			}
		}
	}
}
0