Submission #132983
Source Code Expand
import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int R = sc.nextInt(); int G = sc.nextInt(); int B = sc.nextInt(); int total = R + G + B; int min = Integer.MAX_VALUE; String key = ""; for (int r = -500; r<0; r++) { for (int g=r+R; g<150; g++) { for (int b=g+G; b<200; b++) { int tmp = count(r, r+R-1, g, g+G-1, b, b+B-1); if (tmp < min) { min = tmp; key = r + ":" + (r+R-1) + " " + g + ":" + (g+G-1) + " " + b + ":" + (b+B-1); } } } } System.out.println(min); // System.out.println(key); } private static int count(int rl, int rr, int gl, int gr, int bl, int br) { int step = 0; step += countBase(rl, rr, -100); step += countBase(gl, gr, 0); step += countBase(bl, br, 100); return step; } private static int countBase(int left, int right, int base) { int count = 0; int length = right - left + 1; if (base < left) { count += length * (left - base); count += length * (length + 1) / 2; } else if (right < base) { count += length * (base-right); count += length * (length + 1) / 2; } else { int rLen = right - base; int lLen = base - left; count += rLen * (rLen + 1) / 2; count += lLen * (lLen + 1) / 2; } return count; } }
Submission Info
Submission Time | |
---|---|
Task | D - マーブル |
User | moc |
Language | Java (OpenJDK 1.7.0) |
Score | 40 |
Code Size | 1777 Byte |
Status | WA |
Exec Time | 1112 ms |
Memory | 32828 KB |
Judge Result
Set Name | sub1 | sub2 | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 10 / 10 | 30 / 30 | 0 / 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 | 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 | 1101 ms | 25800 KB |
sample_02_BC.txt | AC | 1016 ms | 25528 KB |
sample_03_C.txt | WA | 516 ms | 24896 KB |
test_ABC_01.txt | AC | 1058 ms | 26924 KB |
test_ABC_02.txt | AC | 1050 ms | 26720 KB |
test_ABC_03.txt | AC | 1068 ms | 27312 KB |
test_ABC_04.txt | AC | 1046 ms | 25816 KB |
test_ABC_05.txt | AC | 1041 ms | 25604 KB |
test_ABC_06.txt | AC | 1038 ms | 25532 KB |
test_ABC_07.txt | AC | 1054 ms | 25528 KB |
test_ABC_08.txt | AC | 1036 ms | 25608 KB |
test_ABC_09.txt | AC | 1090 ms | 25524 KB |
test_ABC_10.txt | AC | 1051 ms | 25616 KB |
test_ABC_11.txt | AC | 1064 ms | 25892 KB |
test_ABC_12.txt | AC | 1035 ms | 25536 KB |
test_ABC_13.txt | AC | 1051 ms | 25792 KB |
test_ABC_14.txt | AC | 1053 ms | 25712 KB |
test_ABC_15.txt | AC | 1034 ms | 25604 KB |
test_ABC_16.txt | AC | 1042 ms | 25560 KB |
test_ABC_17.txt | AC | 1060 ms | 25532 KB |
test_ABC_18.txt | AC | 1072 ms | 25604 KB |
test_ABC_19.txt | AC | 1060 ms | 25796 KB |
test_ABC_20.txt | AC | 1045 ms | 25536 KB |
test_ABC_21.txt | AC | 1052 ms | 25680 KB |
test_ABC_22.txt | AC | 1047 ms | 25800 KB |
test_ABC_23.txt | AC | 1053 ms | 26860 KB |
test_ABC_24.txt | AC | 1070 ms | 25788 KB |
test_ABC_25.txt | AC | 1054 ms | 26300 KB |
test_ABC_26.txt | AC | 1039 ms | 25480 KB |
test_ABC_27.txt | AC | 1089 ms | 27288 KB |
test_ABC_28.txt | AC | 1056 ms | 27268 KB |
test_BC_29.txt | AC | 1030 ms | 27036 KB |
test_BC_30.txt | AC | 1042 ms | 26852 KB |
test_BC_31.txt | AC | 1009 ms | 27576 KB |
test_BC_32.txt | AC | 1053 ms | 27404 KB |
test_BC_33.txt | AC | 982 ms | 26916 KB |
test_BC_34.txt | AC | 995 ms | 27112 KB |
test_BC_35.txt | AC | 1029 ms | 27188 KB |
test_BC_36.txt | AC | 1016 ms | 27328 KB |
test_BC_37.txt | AC | 1023 ms | 27040 KB |
test_BC_38.txt | AC | 964 ms | 26572 KB |
test_BC_39.txt | AC | 1077 ms | 25484 KB |
test_BC_40.txt | AC | 1003 ms | 27400 KB |
test_BC_41.txt | AC | 1015 ms | 27284 KB |
test_BC_42.txt | AC | 978 ms | 27324 KB |
test_BC_43.txt | AC | 1004 ms | 27300 KB |
test_BC_44.txt | AC | 1012 ms | 26916 KB |
test_BC_45.txt | AC | 1087 ms | 25656 KB |
test_BC_46.txt | AC | 935 ms | 27760 KB |
test_BC_47.txt | AC | 1015 ms | 27356 KB |
test_BC_48.txt | AC | 986 ms | 27508 KB |
test_BC_49.txt | AC | 1007 ms | 27236 KB |
test_BC_50.txt | AC | 983 ms | 26636 KB |
test_BC_51.txt | AC | 964 ms | 29224 KB |
test_BC_52.txt | AC | 1083 ms | 25664 KB |
test_BC_53.txt | AC | 1004 ms | 28124 KB |
test_BC_54.txt | AC | 965 ms | 26412 KB |
test_BC_55.txt | AC | 936 ms | 27472 KB |
test_C_56.txt | AC | 783 ms | 27576 KB |
test_C_57.txt | AC | 604 ms | 26520 KB |
test_C_58.txt | WA | 633 ms | 26920 KB |
test_C_59.txt | WA | 570 ms | 27256 KB |
test_C_60.txt | AC | 826 ms | 27324 KB |
test_C_61.txt | AC | 729 ms | 27740 KB |
test_C_62.txt | AC | 771 ms | 26772 KB |
test_C_63.txt | WA | 609 ms | 27144 KB |
test_C_64.txt | AC | 806 ms | 26888 KB |
test_C_65.txt | AC | 718 ms | 25972 KB |
test_C_66.txt | WA | 603 ms | 27364 KB |
test_C_67.txt | WA | 758 ms | 27408 KB |
test_C_68.txt | AC | 878 ms | 27136 KB |
test_C_69.txt | AC | 668 ms | 27188 KB |
test_C_70.txt | AC | 619 ms | 27652 KB |
test_C_71.txt | WA | 698 ms | 27000 KB |
test_C_72.txt | AC | 570 ms | 25436 KB |
test_C_73.txt | WA | 563 ms | 25240 KB |
test_C_74.txt | WA | 650 ms | 27080 KB |
test_C_75.txt | AC | 633 ms | 27132 KB |
test_C_76.txt | WA | 661 ms | 27208 KB |
test_C_77.txt | AC | 634 ms | 26448 KB |
test_C_78.txt | WA | 534 ms | 25668 KB |
test_C_79.txt | WA | 1112 ms | 25924 KB |
test_C_80.txt | WA | 704 ms | 32828 KB |
test_C_81.txt | WA | 640 ms | 29416 KB |
test_C_82.txt | WA | 508 ms | 24912 KB |