結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー | chiho_miyako |
提出日時 | 2015-05-09 00:06:58 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,634 bytes |
コンパイル時間 | 2,362 ms |
コンパイル使用メモリ | 82,524 KB |
実行使用メモリ | 42,800 KB |
最終ジャッジ日時 | 2024-04-21 13:22:06 |
合計ジャッジ時間 | 9,503 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 137 ms
41,880 KB |
testcase_01 | AC | 134 ms
42,224 KB |
testcase_02 | AC | 119 ms
42,556 KB |
testcase_03 | AC | 132 ms
42,720 KB |
testcase_04 | AC | 130 ms
42,304 KB |
testcase_05 | AC | 137 ms
42,608 KB |
testcase_06 | AC | 122 ms
42,684 KB |
testcase_07 | AC | 141 ms
42,524 KB |
testcase_08 | AC | 132 ms
42,440 KB |
testcase_09 | WA | - |
testcase_10 | AC | 131 ms
42,464 KB |
testcase_11 | AC | 129 ms
42,664 KB |
testcase_12 | AC | 115 ms
42,684 KB |
testcase_13 | WA | - |
testcase_14 | AC | 130 ms
42,648 KB |
testcase_15 | AC | 131 ms
42,364 KB |
testcase_16 | AC | 138 ms
42,508 KB |
testcase_17 | AC | 127 ms
42,592 KB |
testcase_18 | WA | - |
testcase_19 | AC | 140 ms
42,424 KB |
testcase_20 | WA | - |
testcase_21 | AC | 151 ms
42,400 KB |
testcase_22 | AC | 127 ms
42,312 KB |
testcase_23 | AC | 130 ms
42,568 KB |
testcase_24 | AC | 135 ms
42,412 KB |
testcase_25 | AC | 139 ms
42,588 KB |
testcase_26 | AC | 119 ms
42,380 KB |
testcase_27 | AC | 137 ms
42,560 KB |
testcase_28 | AC | 128 ms
42,800 KB |
testcase_29 | AC | 120 ms
42,272 KB |
testcase_30 | AC | 129 ms
42,760 KB |
testcase_31 | RE | - |
testcase_32 | AC | 132 ms
42,608 KB |
testcase_33 | AC | 130 ms
42,560 KB |
testcase_34 | AC | 120 ms
42,360 KB |
testcase_35 | AC | 122 ms
42,248 KB |
testcase_36 | RE | - |
testcase_37 | AC | 132 ms
42,608 KB |
testcase_38 | AC | 128 ms
42,540 KB |
testcase_39 | AC | 131 ms
42,508 KB |
testcase_40 | AC | 132 ms
42,732 KB |
testcase_41 | AC | 132 ms
42,376 KB |
testcase_42 | AC | 139 ms
42,488 KB |
testcase_43 | AC | 132 ms
42,568 KB |
testcase_44 | AC | 131 ms
42,444 KB |
testcase_45 | AC | 134 ms
42,392 KB |
testcase_46 | AC | 130 ms
42,712 KB |
testcase_47 | AC | 121 ms
42,720 KB |
testcase_48 | AC | 121 ms
42,464 KB |
ソースコード
import java.util.*; class Ideone{ public static void main (String[] args) throws java.lang.Exception { Scanner koko = new Scanner(System.in); int d = koko.nextInt(); String one = koko.next(); String two = koko.next(); String whole = "xxxxxxxxxxxxxx" + one + two + "xxxxxxxxxxxxxx"; if(whole.equals("xxxxxxxxxxxxxxxxxxxxxxxxxxxx")){ System.out.println(d); }else{ String[] on = whole.split("o+"); int[] onseq = new int[on.length]; int counton = 0; int countoff = 0; int onp =0; int offp =0; for(int i=0; i<on.length; i++){ if(on[i].length()!=0){ onseq[onp++]=on[i].length(); counton++; } } String[] off = whole.split("x+"); int[] offseq = new int[off.length]; for(int i=0; i<off.length; i++){ if(off[i].length()!=0){ offseq[offp++]=off[i].length(); countoff++; } } int max=0; if(onseq[0]<=d){ max=onseq[0]+offseq[0]; } if(countoff==1){ if(on[1].length()<=d){ max=Math.max(max, offseq[0]+onseq[1]); }else{ max=Math.max(max, offseq[0]+d); } }else{ for(int i=1; i<counton-1; i++){ if(onseq[i]<=d){ max=Math.max(max, offseq[i-1]+onseq[i]+offseq[i]); }else{ max=Math.max(max, offseq[i-1]+d); max=Math.max(max, offseq[i]+d); } } max=Math.max(max, offseq[countoff-1]+Math.min(d, onseq[counton-1])); } System.out.println(max); } } }