結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー | kuramu |
提出日時 | 2016-01-30 14:16:19 |
言語 | Java21 (openjdk 21) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,782 bytes |
コンパイル時間 | 2,321 ms |
コンパイル使用メモリ | 77,612 KB |
実行使用メモリ | 52,348 KB |
最終ジャッジ日時 | 2024-04-21 15:04:06 |
合計ジャッジ時間 | 5,692 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
50,184 KB |
testcase_01 | AC | 50 ms
50,340 KB |
testcase_02 | AC | 47 ms
50,484 KB |
testcase_03 | AC | 46 ms
50,388 KB |
testcase_04 | AC | 47 ms
50,256 KB |
testcase_05 | AC | 47 ms
49,988 KB |
testcase_06 | AC | 47 ms
50,144 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 49 ms
50,208 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 48 ms
50,252 KB |
testcase_23 | WA | - |
testcase_24 | AC | 50 ms
50,220 KB |
testcase_25 | AC | 50 ms
50,080 KB |
testcase_26 | AC | 48 ms
50,360 KB |
testcase_27 | AC | 49 ms
50,268 KB |
testcase_28 | AC | 48 ms
50,472 KB |
testcase_29 | AC | 48 ms
50,308 KB |
testcase_30 | AC | 48 ms
50,300 KB |
testcase_31 | AC | 49 ms
50,324 KB |
testcase_32 | AC | 49 ms
50,352 KB |
testcase_33 | AC | 49 ms
50,268 KB |
testcase_34 | AC | 51 ms
50,144 KB |
testcase_35 | AC | 50 ms
50,396 KB |
testcase_36 | AC | 60 ms
50,396 KB |
testcase_37 | AC | 49 ms
50,320 KB |
testcase_38 | AC | 49 ms
50,432 KB |
testcase_39 | AC | 52 ms
50,448 KB |
testcase_40 | AC | 50 ms
49,892 KB |
testcase_41 | AC | 49 ms
50,268 KB |
testcase_42 | AC | 49 ms
50,204 KB |
testcase_43 | AC | 49 ms
49,896 KB |
testcase_44 | AC | 50 ms
50,160 KB |
testcase_45 | AC | 48 ms
50,288 KB |
testcase_46 | AC | 49 ms
50,392 KB |
testcase_47 | AC | 50 ms
50,456 KB |
testcase_48 | AC | 49 ms
50,416 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int D; public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); boolean[] N = new boolean[14]; try { D = Integer.parseInt(stdReader.readLine()); String[] temp1 = stdReader.readLine().split(""); String[] temp2 = stdReader.readLine().split(""); int ans = 0; for(int i=0;i<7;i++) if(temp1[i].equals("o")) N[i] = true; for(int i=7;i<14;i++) if(temp2[i-7].equals("o")) N[i] = true; ans = calc(-1,N); for(int i=0;i<14;i++){ int count = 0; for(int j=0;j<D && i+j <14 ;j++){ if(!N[i+j]){ count++; N[i+j] = true; }else{ break; } } ans = Math.max(ans, calc(i,N)); for(int j=0;j<count;j++){ N[i+j] = false; } } System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } public static int calc(int num,boolean[] N){ int count = 0; int ans = 0; if(num==-1){ count = D; for(int i=0;i<N.length;i++){ if(N[i]){ count++; }else{ ans = Math.max(ans, count); count=0; } } ans = Math.max(ans, count); count = D; for(int i=N.length-1;i>=0;i--){ if(N[i]){ count++; }else{ ans = Math.max(ans, count); count=0; } } }else{ for(int i=0;i<N.length;i++){ if(N[i]){ count++; }else{ ans = Math.max(ans, count); count=0; } } ans = Math.max(ans, count); } return ans; } }