結果
問題 | No.2000 Distanced Characters |
ユーザー | siman |
提出日時 | 2023-03-08 18:37:33 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 476 ms |
コンパイル使用メモリ | 11,912 KB |
実行使用メモリ | 23,016 KB |
最終ジャッジ日時 | 2023-10-18 06:01:07 |
合計ジャッジ時間 | 6,172 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 86 ms
16,124 KB |
testcase_01 | AC | 87 ms
16,124 KB |
testcase_02 | AC | 85 ms
16,124 KB |
testcase_03 | AC | 85 ms
16,124 KB |
testcase_04 | AC | 109 ms
16,124 KB |
testcase_05 | AC | 97 ms
16,124 KB |
testcase_06 | AC | 95 ms
16,124 KB |
testcase_07 | AC | 94 ms
16,120 KB |
testcase_08 | AC | 404 ms
18,520 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
S = gets.chomp N = S.size D = 26.times.map { gets.split.map(&:to_i) } memo = Hash.new { |h, k| h[k] = [] } N.times do |i| ch = S[i] memo[ch] << i end ans = [] 26.times do |i| c1 = ('a'.ord + i).chr row = [] 26.times do |j| c2 = ('a'.ord + j).chr d = D[i][j] if memo[c1].empty? || memo[c2].empty? row << 'Y' else ok = true memo[c1].each do |x| res = memo[c2].bsearch { |y| y > x } if res && x + d > res ok = false end end if ok row << 'Y' else row << 'N' end end end ans << row end puts ans.map { |row| row.join(' ') }