結果
| 問題 |
No.854 公平なりんご分配
|
| ユーザー |
|
| 提出日時 | 2019-07-26 21:51:43 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 301 bytes |
| コンパイル時間 | 39 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 287,360 KB |
| 最終ジャッジ日時 | 2024-07-02 07:01:50 |
| 合計ジャッジ時間 | 9,115 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 TLE * 1 -- * 61 |
コンパイルメッセージ
Syntax OK
ソースコード
P = 10**9+7
N = gets.to_i
A = gets.split.map &:to_i
Q = gets.to_i
PLR = $<.map{|s|
s.split.map &:to_i
}
cumul = [mul = 1] + A.map{|a| mul *= (a == 0 ? P : a) }
# p cumul
PLR.each{|p, l, r|
mul = cumul[r] / cumul[l-1]
if mul % P == 0 || mul % p == 0
puts "Yes"
else
puts "NO"
end
}