結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー |
![]() |
提出日時 | 2016-07-15 22:55:19 |
言語 | Ruby (3.4.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 537 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 43,948 KB |
最終ジャッジ日時 | 2024-07-17 00:05:39 |
合計ジャッジ時間 | 6,551 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 17 |
コンパイルメッセージ
Syntax OK
ソースコード
n = gets.to_i a = gets.split.map(&:to_i) gets def check x x.each_cons(3).any? { |a,b,c| next true if a < b && b > c && a != c next true if a > b && b < c && a != c next false } end ans = [] while check a u,v = -1,-1 while u == v u = rand n v = rand n end a[u], a[v] = a[v], a[u] ans << [u,v] end puts ans.size ans.each { |a,b| puts "#{a} #{b}" }