結果
| 問題 |
No.1859 ><<<
|
| ユーザー |
siman
|
| 提出日時 | 2022-02-27 14:59:09 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 377 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 139,432 KB |
| 最終ジャッジ日時 | 2024-07-05 14:40:47 |
| 合計ジャッジ時間 | 6,891 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | TLE * 1 -- * 40 |
コンパイルメッセージ
Main.rb:41: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
N = gets.to_i
A = gets.split.map(&:to_i)
S = gets.chomp
sum = 0
base = 1
S.each_char do |s|
if s == '<'
sum += base
end
base *= 2
end
v = 0
base = 1
A.each_cons(2) do |a, b|
if a < b
v += base
end
base *= 2
end
base = 2 ** (N - 2)
N.times do |i|
if sum == v
puts i
exit
end
v /= 2
A.rotate!(1)
if A[-2] < A[-1]
v += base
end
end
puts -1
siman