Submission #51705862
Source Code Expand
K,X1,Y1,X2,Y2 = $<.read.split.map(&:to_i)
dx,dy = [(X2-X1).abs,(Y2-Y1).abs].sort
dy -= dx
kx,rx = dx.divmod K
ky,ry = dy.divmod K+K
f,t = false,true
warn [kx+ky+ky,[rx,rx+ry],K].inspect
p kx+ky+ky+case [0<rx,0<ry]
when [f,f]; 0
when [t,f]; 1
when [f,t]; 2
when [t,t]; [rx,ry].minmax.then{|m,x| x+x+m<=K+K } ? 2 : 3
end
Submission Info
| Submission Time | |
|---|---|
| Task | D - Bishop |
| User | ds14050 |
| Language | Ruby (ruby 3.2.2) |
| Score | 0 |
| Code Size | 332 Byte |
| Status | WA |
| Exec Time | 45 ms |
| Memory | 17352 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 200 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | example0.txt, example1.txt, maximum0.txt, maximum1.txt, maximum2.txt, maximum3.txt, random0.txt, random1.txt, random2.txt, random3.txt, random4.txt, random5.txt, random6.txt, random7.txt, random8.txt, random9.txt, random_k_small0.txt, random_k_small1.txt, random_k_small2.txt, random_k_small3.txt, random_k_small4.txt, random_k_small5.txt, random_k_small6.txt, random_k_small7.txt, random_k_small8.txt, random_k_small9.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example0.txt | AC | 44 ms | 17260 KiB |
| example1.txt | AC | 45 ms | 17260 KiB |
| maximum0.txt | AC | 44 ms | 16896 KiB |
| maximum1.txt | AC | 45 ms | 17308 KiB |
| maximum2.txt | AC | 43 ms | 17312 KiB |
| maximum3.txt | AC | 45 ms | 17296 KiB |
| random0.txt | WA | 44 ms | 17100 KiB |
| random1.txt | AC | 44 ms | 17288 KiB |
| random2.txt | AC | 45 ms | 17080 KiB |
| random3.txt | AC | 45 ms | 17196 KiB |
| random4.txt | AC | 44 ms | 17204 KiB |
| random5.txt | AC | 45 ms | 17252 KiB |
| random6.txt | AC | 45 ms | 17140 KiB |
| random7.txt | AC | 44 ms | 17244 KiB |
| random8.txt | AC | 44 ms | 17124 KiB |
| random9.txt | AC | 44 ms | 17160 KiB |
| random_k_small0.txt | AC | 44 ms | 17092 KiB |
| random_k_small1.txt | AC | 45 ms | 17236 KiB |
| random_k_small2.txt | AC | 45 ms | 17352 KiB |
| random_k_small3.txt | AC | 44 ms | 17296 KiB |
| random_k_small4.txt | AC | 45 ms | 17328 KiB |
| random_k_small5.txt | AC | 44 ms | 17128 KiB |
| random_k_small6.txt | AC | 44 ms | 17208 KiB |
| random_k_small7.txt | WA | 44 ms | 17312 KiB |
| random_k_small8.txt | AC | 44 ms | 17052 KiB |
| random_k_small9.txt | AC | 45 ms | 17252 KiB |