Submission #21541500
Source Code Expand
Copy
class Mdef initialize center,count@中心 = center@左端 = center-(count-1)/2@右端 = center+count/2endattr_reader :左端,:右端attr_accessor :左隣,:右隣def inspect[@左端..@右端,回数,右押す,左押す].inspectenddef 回数[@中心-@左端,@右端-@中心].sum{|n| n*(n+1).abs/2 }enddef 右?@左隣 && @左端 <= @左隣.右端 or 0 < 右押すenddef 左?@右隣 && @右隣.左端 <= @右端 or 0 < 左押すend
class M def initialize center,count @中心 = center @左端 = center-(count-1)/2 @右端 = center+count/2 end attr_reader :左端,:右端 attr_accessor :左隣,:右隣 def inspect [@左端..@右端,回数,右押す,左押す].inspect end def 回数 [@中心-@左端,@右端-@中心].sum{|n| n*(n+1).abs/2 } end def 右? @左隣 && @左端 <= @左隣.右端 or 0 < 右押す end def 左? @右隣 && @右隣.左端 <= @右端 or 0 < 左押す end def 右接触? @右隣 && @右隣.左端-1 == @右端 end def 左接触? @左隣 && @左隣.右端+1 == @左端 end def 右押す (@左端-@中心).abs-(@右端+1-@中心).abs+(右接触? ? @右隣.右押す : 0) end def 左押す (@右端-@中心).abs-(@左端-1-@中心).abs+(左接触? ? @左隣.左押す : 0) end def 右へ @右隣.右へ if 右接触? @左端 += 1 @右端 += 1 end def 左へ @左隣.左へ if 左接触? @左端 -= 1 @右端 -= 1 end end R,G,B = RGB = [-100,0,100].zip(gets.split).map{ M.new _1,_2.to_i } R.右隣,G.左隣 = G,R G.右隣,B.左隣 = B,G R.左へ while R.左? B.右へ while B.右? R.右へ while R.右? B.左へ while B.左? p RGB.sum(&:回数)
Submission Info
Submission Time | |
---|---|
Task | D - マーブル |
User | ds14050 |
Language | Ruby (2.7.1) |
Score | 100 |
Code Size | 1246 Byte |
Status | AC |
Exec Time | 65 ms |
Memory | 14476 KB |
Judge Result
Set Name | sub1 | sub2 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 10 / 10 | 30 / 30 | 60 / 60 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sub1 | sample_01_ABC.txt, test_ABC_01.txt, test_ABC_02.txt, test_ABC_03.txt, test_ABC_04.txt, test_ABC_05.txt, test_ABC_06.txt, test_ABC_07.txt, test_ABC_08.txt, test_ABC_09.txt, test_ABC_10.txt, test_ABC_11.txt, test_ABC_12.txt, test_ABC_13.txt, test_ABC_14.txt, test_ABC_15.txt, test_ABC_16.txt, test_ABC_17.txt, test_ABC_18.txt, test_ABC_19.txt, test_ABC_20.txt, test_ABC_21.txt, test_ABC_22.txt, test_ABC_23.txt, test_ABC_24.txt, test_ABC_25.txt, test_ABC_26.txt, test_ABC_27.txt, test_ABC_28.txt |
sub2 | sample_01_ABC.txt, sample_02_BC.txt, test_ABC_01.txt, test_ABC_02.txt, test_ABC_03.txt, test_ABC_04.txt, test_ABC_05.txt, test_ABC_06.txt, test_ABC_07.txt, test_ABC_08.txt, test_ABC_09.txt, test_ABC_10.txt, test_ABC_11.txt, test_ABC_12.txt, test_ABC_13.txt, test_ABC_14.txt, test_ABC_15.txt, test_ABC_16.txt, test_ABC_17.txt, test_ABC_18.txt, test_ABC_19.txt, test_ABC_20.txt, test_ABC_21.txt, test_ABC_22.txt, test_ABC_23.txt, test_ABC_24.txt, test_ABC_25.txt, test_ABC_26.txt, test_ABC_27.txt, test_ABC_28.txt, test_BC_29.txt, test_BC_30.txt, test_BC_31.txt, test_BC_32.txt, test_BC_33.txt, test_BC_34.txt, test_BC_35.txt, test_BC_36.txt, test_BC_37.txt, test_BC_38.txt, test_BC_39.txt, test_BC_40.txt, test_BC_41.txt, test_BC_42.txt, test_BC_43.txt, test_BC_44.txt, test_BC_45.txt, test_BC_46.txt, test_BC_47.txt, test_BC_48.txt, test_BC_49.txt, test_BC_50.txt, test_BC_51.txt, test_BC_52.txt, test_BC_53.txt, test_BC_54.txt, test_BC_55.txt |
All | sample_01_ABC.txt, sample_02_BC.txt, sample_03_C.txt, test_ABC_01.txt, test_ABC_02.txt, test_ABC_03.txt, test_ABC_04.txt, test_ABC_05.txt, test_ABC_06.txt, test_ABC_07.txt, test_ABC_08.txt, test_ABC_09.txt, test_ABC_10.txt, test_ABC_11.txt, test_ABC_12.txt, test_ABC_13.txt, test_ABC_14.txt, test_ABC_15.txt, test_ABC_16.txt, test_ABC_17.txt, test_ABC_18.txt, test_ABC_19.txt, test_ABC_20.txt, test_ABC_21.txt, test_ABC_22.txt, test_ABC_23.txt, test_ABC_24.txt, test_ABC_25.txt, test_ABC_26.txt, test_ABC_27.txt, test_ABC_28.txt, test_BC_29.txt, test_BC_30.txt, test_BC_31.txt, test_BC_32.txt, test_BC_33.txt, test_BC_34.txt, test_BC_35.txt, test_BC_36.txt, test_BC_37.txt, test_BC_38.txt, test_BC_39.txt, test_BC_40.txt, test_BC_41.txt, test_BC_42.txt, test_BC_43.txt, test_BC_44.txt, test_BC_45.txt, test_BC_46.txt, test_BC_47.txt, test_BC_48.txt, test_BC_49.txt, test_BC_50.txt, test_BC_51.txt, test_BC_52.txt, test_BC_53.txt, test_BC_54.txt, test_BC_55.txt, test_C_56.txt, test_C_57.txt, test_C_58.txt, test_C_59.txt, test_C_60.txt, test_C_61.txt, test_C_62.txt, test_C_63.txt, test_C_64.txt, test_C_65.txt, test_C_66.txt, test_C_67.txt, test_C_68.txt, test_C_69.txt, test_C_70.txt, test_C_71.txt, test_C_72.txt, test_C_73.txt, test_C_74.txt, test_C_75.txt, test_C_76.txt, test_C_77.txt, test_C_78.txt, test_C_79.txt, test_C_80.txt, test_C_81.txt, test_C_82.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01_ABC.txt | AC | 62 ms | 14316 KB |
sample_02_BC.txt | AC | 58 ms | 14212 KB |
sample_03_C.txt | AC | 62 ms | 14228 KB |
test_ABC_01.txt | AC | 61 ms | 14228 KB |
test_ABC_02.txt | AC | 61 ms | 14236 KB |
test_ABC_03.txt | AC | 65 ms | 14232 KB |
test_ABC_04.txt | AC | 58 ms | 14296 KB |
test_ABC_05.txt | AC | 61 ms | 14356 KB |
test_ABC_06.txt | AC | 58 ms | 14456 KB |
test_ABC_07.txt | AC | 61 ms | 14320 KB |
test_ABC_08.txt | AC | 59 ms | 14232 KB |
test_ABC_09.txt | AC | 61 ms | 14308 KB |
test_ABC_10.txt | AC | 59 ms | 14328 KB |
test_ABC_11.txt | AC | 60 ms | 14116 KB |
test_ABC_12.txt | AC | 61 ms | 14248 KB |
test_ABC_13.txt | AC | 58 ms | 14332 KB |
test_ABC_14.txt | AC | 60 ms | 14280 KB |
test_ABC_15.txt | AC | 58 ms | 14112 KB |
test_ABC_16.txt | AC | 61 ms | 14308 KB |
test_ABC_17.txt | AC | 63 ms | 14204 KB |
test_ABC_18.txt | AC | 61 ms | 14280 KB |
test_ABC_19.txt | AC | 63 ms | 14316 KB |
test_ABC_20.txt | AC | 60 ms | 14272 KB |
test_ABC_21.txt | AC | 61 ms | 14276 KB |
test_ABC_22.txt | AC | 62 ms | 14252 KB |
test_ABC_23.txt | AC | 57 ms | 14208 KB |
test_ABC_24.txt | AC | 59 ms | 14252 KB |
test_ABC_25.txt | AC | 58 ms | 14320 KB |
test_ABC_26.txt | AC | 60 ms | 14272 KB |
test_ABC_27.txt | AC | 61 ms | 14356 KB |
test_ABC_28.txt | AC | 61 ms | 14212 KB |
test_BC_29.txt | AC | 62 ms | 14324 KB |
test_BC_30.txt | AC | 61 ms | 14220 KB |
test_BC_31.txt | AC | 56 ms | 14228 KB |
test_BC_32.txt | AC | 59 ms | 14352 KB |
test_BC_33.txt | AC | 61 ms | 14296 KB |
test_BC_34.txt | AC | 61 ms | 14312 KB |
test_BC_35.txt | AC | 62 ms | 14236 KB |
test_BC_36.txt | AC | 60 ms | 14188 KB |
test_BC_37.txt | AC | 62 ms | 14224 KB |
test_BC_38.txt | AC | 60 ms | 14308 KB |
test_BC_39.txt | AC | 54 ms | 14232 KB |
test_BC_40.txt | AC | 59 ms | 14112 KB |
test_BC_41.txt | AC | 58 ms | 14328 KB |
test_BC_42.txt | AC | 61 ms | 14288 KB |
test_BC_43.txt | AC | 60 ms | 14316 KB |
test_BC_44.txt | AC | 59 ms | 14336 KB |
test_BC_45.txt | AC | 59 ms | 14304 KB |
test_BC_46.txt | AC | 62 ms | 14228 KB |
test_BC_47.txt | AC | 62 ms | 14352 KB |
test_BC_48.txt | AC | 57 ms | 14208 KB |
test_BC_49.txt | AC | 63 ms | 14220 KB |
test_BC_50.txt | AC | 59 ms | 14396 KB |
test_BC_51.txt | AC | 60 ms | 14276 KB |
test_BC_52.txt | AC | 59 ms | 14264 KB |
test_BC_53.txt | AC | 57 ms | 14328 KB |
test_BC_54.txt | AC | 60 ms | 14172 KB |
test_BC_55.txt | AC | 59 ms | 14288 KB |
test_C_56.txt | AC | 62 ms | 14288 KB |
test_C_57.txt | AC | 61 ms | 14344 KB |
test_C_58.txt | AC | 61 ms | 14116 KB |
test_C_59.txt | AC | 58 ms | 14272 KB |
test_C_60.txt | AC | 59 ms | 14424 KB |
test_C_61.txt | AC | 61 ms | 14212 KB |
test_C_62.txt | AC | 59 ms | 14408 KB |
test_C_63.txt | AC | 58 ms | 14476 KB |
test_C_64.txt | AC | 57 ms | 14452 KB |
test_C_65.txt | AC | 61 ms | 14240 KB |
test_C_66.txt | AC | 56 ms | 14464 KB |
test_C_67.txt | AC | 59 ms | 14240 KB |
test_C_68.txt | AC | 61 ms | 14240 KB |
test_C_69.txt | AC | 59 ms | 14096 KB |
test_C_70.txt | AC | 63 ms | 14228 KB |
test_C_71.txt | AC | 62 ms | 14452 KB |
test_C_72.txt | AC | 57 ms | 14472 KB |
test_C_73.txt | AC | 58 ms | 14356 KB |
test_C_74.txt | AC | 58 ms | 14432 KB |
test_C_75.txt | AC | 62 ms | 14380 KB |
test_C_76.txt | AC | 56 ms | 14212 KB |
test_C_77.txt | AC | 58 ms | 14400 KB |
test_C_78.txt | AC | 62 ms | 14248 KB |
test_C_79.txt | AC | 60 ms | 14308 KB |
test_C_80.txt | AC | 60 ms | 14352 KB |
test_C_81.txt | AC | 63 ms | 14360 KB |
test_C_82.txt | AC | 58 ms | 14420 KB |