結果
| 問題 |
No.1279 Array Battle
|
| ユーザー |
|
| 提出日時 | 2020-12-08 18:49:20 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 333 ms / 2,000 ms |
| コード長 | 400 bytes |
| コンパイル時間 | 358 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 13,440 KB |
| 最終ジャッジ日時 | 2024-09-17 19:49:57 |
| 合計ジャッジ時間 | 4,731 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_s.to_i
a = gets.to_s.split.map(&:to_i).sort
b = gets.to_s.split.map(&:to_i)
count = 0
current_max_score = 0
a.permutation do |array|
i = 0
score = 0
while i < n
diff = array[i] - b[i]
score += diff if diff > 0
i += 1
end
if score > current_max_score
count = 1
current_max_score = score
elsif score == current_max_score
count += 1
end
end
puts count