結果
問題 | No.1279 Array Battle |
ユーザー |
|
提出日時 | 2020-12-08 19:03:38 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 398 ms / 2,000 ms |
コード長 | 301 bytes |
コンパイル時間 | 67 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 13,312 KB |
最終ジャッジ日時 | 2024-09-17 20:03:50 |
合計ジャッジ時間 | 4,204 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_s.to_i a = gets.to_s.split.map(&:to_i) b = gets.to_s.split.map(&:to_i) m = 0 ans = 0 a.permutation do |a| s = 0 i = 0 while i < n if (d = a[i] - b[i]) && d > 0 s += d end i += 1 end if s > m ans = 1 m = s elsif s == m ans += 1 end end puts ans