Submission #66801656
Source Code Expand
puts gets.to_i.times.map{
h,w = gets.split.map(&:to_i)
g = h.times.map{ gets.chomp.bytes.map{ [-1,1][_1&1] } }
h,w,g = w,h,g.transpose unless h<w
sc = g.transpose.map{|c| c.inject([0]){|s,c| s<<s[-1]+c } }
[*0..h].combination(2).sum{|i0,i1|
ts = Hash.new 0
s = 0
ts[s] += 1
sc.sum{|sc|
s += sc[i1]-sc[i0]
-1+ts[s] += 1
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | F - Balanced Rectangles |
| User | ds14050 |
| Language | Ruby (ruby 3.2.2) |
| Score | 0 |
| Code Size | 364 Byte |
| Status | TLE |
| Exec Time | 3321 ms |
| Memory | 104316 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 525 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand_01.txt | AC | 529 ms | 91632 KiB |
| hand_02.txt | AC | 284 ms | 80516 KiB |
| hand_03.txt | AC | 421 ms | 72768 KiB |
| hand_04.txt | AC | 227 ms | 57824 KiB |
| sample_01.txt | AC | 49 ms | 17452 KiB |
| test_01.txt | AC | 44 ms | 17200 KiB |
| test_02.txt | AC | 47 ms | 17224 KiB |
| test_03.txt | AC | 49 ms | 17432 KiB |
| test_04.txt | AC | 44 ms | 17488 KiB |
| test_05.txt | AC | 45 ms | 17384 KiB |
| test_06.txt | AC | 47 ms | 17576 KiB |
| test_07.txt | AC | 49 ms | 17500 KiB |
| test_08.txt | AC | 57 ms | 17472 KiB |
| test_09.txt | AC | 60 ms | 17404 KiB |
| test_10.txt | AC | 87 ms | 17544 KiB |
| test_11.txt | AC | 91 ms | 17564 KiB |
| test_12.txt | AC | 324 ms | 17668 KiB |
| test_13.txt | AC | 250 ms | 17368 KiB |
| test_14.txt | AC | 228 ms | 57108 KiB |
| test_15.txt | AC | 321 ms | 64672 KiB |
| test_16.txt | TLE | 3321 ms | 104316 KiB |
| test_17.txt | TLE | 3316 ms | 93816 KiB |
| test_18.txt | TLE | 3316 ms | 86924 KiB |
| test_19.txt | TLE | 3316 ms | 97760 KiB |
| test_20.txt | AC | 334 ms | 17752 KiB |
| test_21.txt | TLE | 3315 ms | 79536 KiB |
| test_22.txt | TLE | 3315 ms | 83732 KiB |
| test_23.txt | TLE | 3316 ms | 87736 KiB |
| test_24.txt | TLE | 3316 ms | 87340 KiB |
| test_25.txt | TLE | 3316 ms | 97412 KiB |
| test_26.txt | TLE | 3314 ms | 66572 KiB |
| test_27.txt | TLE | 3316 ms | 91180 KiB |
| test_28.txt | AC | 1745 ms | 84964 KiB |
| test_29.txt | TLE | 3161 ms | 82404 KiB |
| test_30.txt | TLE | 3315 ms | 85476 KiB |
| test_31.txt | TLE | 3317 ms | 103364 KiB |
| test_32.txt | TLE | 3317 ms | 101668 KiB |
| test_33.txt | TLE | 3312 ms | 29620 KiB |
| test_34.txt | TLE | 3312 ms | 30056 KiB |
| test_35.txt | TLE | 3312 ms | 30228 KiB |
| test_36.txt | TLE | 3312 ms | 31060 KiB |
| test_37.txt | TLE | 3312 ms | 30036 KiB |
| test_38.txt | AC | 1807 ms | 33748 KiB |