Submission #51750508
Source Code Expand
N,K,*A = $<.read.split.map(&:to_i)
I = []
(N-1).times{|i|
j = (i...N).min_by{|j| A[j] }
(j-1).downto(i){|j|
A[j] += K
I<<j+1
}
A[i],A[j] = A[j],A[i]
}
warn A.each_cons(2).all?{_1<=_2}
puts I.size,I
Submission Info
| Submission Time | |
|---|---|
| Task | I - Swap and Sort |
| User | ds14050 |
| Language | Ruby (ruby 3.2.2) |
| Score | 0 |
| Code Size | 222 Byte |
| Status | WA |
| Exec Time | 254 ms |
| Memory | 22532 KiB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | example0.txt, example1.txt, maximum0.txt, maximum1.txt, maximum2.txt, maximum3.txt, maximum4.txt, maximum5.txt, maximum6.txt, maximum7.txt, maximum8.txt, random0.txt, random1.txt, random10.txt, random11.txt, random12.txt, random13.txt, random14.txt, random2.txt, random3.txt, random4.txt, random5.txt, random6.txt, random7.txt, random8.txt, random9.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example0.txt | AC | 128 ms | 16924 KiB |
| example1.txt | WA | 45 ms | 17316 KiB |
| maximum0.txt | WA | 54 ms | 17772 KiB |
| maximum1.txt | WA | 55 ms | 17648 KiB |
| maximum2.txt | WA | 181 ms | 20408 KiB |
| maximum3.txt | WA | 249 ms | 21652 KiB |
| maximum4.txt | WA | 249 ms | 21712 KiB |
| maximum5.txt | WA | 247 ms | 21624 KiB |
| maximum6.txt | WA | 250 ms | 21552 KiB |
| maximum7.txt | WA | 254 ms | 22532 KiB |
| maximum8.txt | WA | 254 ms | 21604 KiB |
| random0.txt | WA | 68 ms | 18316 KiB |
| random1.txt | WA | 44 ms | 17580 KiB |
| random10.txt | WA | 59 ms | 18012 KiB |
| random11.txt | WA | 44 ms | 17436 KiB |
| random12.txt | WA | 78 ms | 18320 KiB |
| random13.txt | WA | 90 ms | 18632 KiB |
| random14.txt | WA | 103 ms | 18772 KiB |
| random2.txt | WA | 118 ms | 19220 KiB |
| random3.txt | WA | 86 ms | 18524 KiB |
| random4.txt | WA | 44 ms | 17072 KiB |
| random5.txt | WA | 45 ms | 17540 KiB |
| random6.txt | WA | 138 ms | 19332 KiB |
| random7.txt | WA | 192 ms | 20592 KiB |
| random8.txt | WA | 126 ms | 19272 KiB |
| random9.txt | WA | 93 ms | 18292 KiB |