結果
| 問題 |
No.1439 Let's Compare!!!!
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-04-01 19:49:59 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 836 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 78,204 KB |
| 最終ジャッジ日時 | 2024-12-18 00:52:36 |
| 合計ジャッジ時間 | 20,022 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 RE * 2 TLE * 6 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
S = gets.chomp
T = gets.chomp
Q = gets.to_i
state = S <=> T
idx_list = [*0..N]
nums = Array.new(N) { Array.new(2, 0) }
stacked = Hash.new(false)
N.times do |i|
nums[i][0] = S[i].to_i
nums[i][1] = T[i].to_i
stacked[i] = true
end
Q.times do
c, x, y = gets.chomp.split
x = x.to_i - 1
y = y.to_i
if !stacked[x]
idx = idx_list.bsearch_index { |i| i > x }
if idx.nil?
idx_list << x
else
idx_list.insert(idx, x)
end
end
if c == 'S'
nums[x][0] = y
else
nums[x][1] = y
end
until idx_list.empty?
i = idx_list.first
state = nums[i][0] <=> nums[i][1]
break if state != 0
stacked[i] = false
idx_list.shift
end
if idx_list.empty?
state = 0
end
case state
when -1
puts '<'
when 0
puts '=='
when 1
puts '>'
end
end
siman