Submission #21665467
Source Code Expand
Copy
A,B,S = $<.map(&:chomp)C = (A+B+S).chars.uniq*''D = '0123456789'.chars.permutation(C.size).find{|ds|ds *= ''a = A.tr C,dsb = B.tr C,dss = S.tr C,dsnext a.to_i+b.to_i==s.to_i && a[0]!=?0 && b[0]!=?0 && s[0]!=?0}puts(D ? [A,B,S].map{_1.tr C,D*''} :'UNSOLVABLE')
A,B,S = $<.map(&:chomp) C = (A+B+S).chars.uniq*'' D = '0123456789'.chars.permutation(C.size).find{|ds| ds *= '' a = A.tr C,ds b = B.tr C,ds s = S.tr C,ds next a.to_i+b.to_i==s.to_i && a[0]!=?0 && b[0]!=?0 && s[0]!=?0 } puts(D ? [A,B,S].map{_1.tr C,D*''} :'UNSOLVABLE')
Submission Info
Submission Time | |
---|---|
Task | D - Send More Money |
User | ds14050 |
Language | Ruby (2.7.1) |
Score | 0 |
Code Size | 284 Byte |
Status | TLE |
Exec Time | 5513 ms |
Memory | 14516 KB |
Compile Error
./Main.rb:10: warning: `:' after local variable or literal is interpreted as binary operator ./Main.rb:10: warning: even though it seems like symbol literal
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt |
All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 66 ms | 14372 KB |
hand_02.txt | AC | 100 ms | 14272 KB |
hand_03.txt | AC | 63 ms | 14388 KB |
hand_04.txt | AC | 58 ms | 13984 KB |
hand_05.txt | AC | 61 ms | 14248 KB |
random_01.txt | AC | 3566 ms | 14312 KB |
random_02.txt | TLE | 5470 ms | 14068 KB |
random_03.txt | AC | 829 ms | 14300 KB |
random_04.txt | AC | 1005 ms | 14048 KB |
random_05.txt | AC | 408 ms | 14128 KB |
random_06.txt | AC | 2359 ms | 14384 KB |
random_07.txt | AC | 1001 ms | 14136 KB |
random_08.txt | AC | 4732 ms | 14304 KB |
random_09.txt | TLE | 5513 ms | 14472 KB |
random_10.txt | AC | 2473 ms | 14256 KB |
random_11.txt | AC | 724 ms | 14396 KB |
random_12.txt | AC | 1183 ms | 14152 KB |
random_13.txt | AC | 836 ms | 14164 KB |
random_14.txt | AC | 3450 ms | 14160 KB |
random_15.txt | AC | 116 ms | 14244 KB |
random_16.txt | TLE | 5513 ms | 14148 KB |
random_17.txt | AC | 475 ms | 14312 KB |
random_18.txt | AC | 2216 ms | 14244 KB |
random_19.txt | TLE | 5513 ms | 14280 KB |
random_20.txt | AC | 1597 ms | 14248 KB |
random_21.txt | AC | 54 ms | 14160 KB |
random_22.txt | AC | 102 ms | 14292 KB |
random_23.txt | AC | 59 ms | 14196 KB |
random_24.txt | AC | 98 ms | 14196 KB |
random_25.txt | AC | 883 ms | 13992 KB |
random_26.txt | AC | 660 ms | 14020 KB |
random_27.txt | AC | 56 ms | 14148 KB |
random_28.txt | TLE | 5513 ms | 14516 KB |
random_29.txt | AC | 411 ms | 14200 KB |
random_30.txt | TLE | 5513 ms | 14172 KB |
sample_01.txt | AC | 57 ms | 14176 KB |
sample_02.txt | AC | 57 ms | 14192 KB |
sample_03.txt | AC | 56 ms | 14024 KB |
sample_04.txt | AC | 59 ms | 14264 KB |
sample_05.txt | AC | 3344 ms | 14248 KB |