結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー uafr_csuafr_cs
提出日時 2015-06-20 02:01:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,304 bytes
コンパイル時間 2,381 ms
コンパイル使用メモリ 78,076 KB
実行使用メモリ 41,668 KB
最終ジャッジ日時 2024-04-21 14:39:36
合計ジャッジ時間 11,088 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 149 ms
41,192 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 148 ms
41,580 KB
testcase_05 AC 146 ms
41,380 KB
testcase_06 AC 145 ms
41,008 KB
testcase_07 AC 144 ms
41,360 KB
testcase_08 AC 146 ms
41,256 KB
testcase_09 AC 143 ms
41,168 KB
testcase_10 AC 147 ms
41,020 KB
testcase_11 WA -
testcase_12 AC 143 ms
41,176 KB
testcase_13 AC 143 ms
41,256 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 145 ms
41,024 KB
testcase_17 AC 148 ms
41,464 KB
testcase_18 AC 148 ms
41,084 KB
testcase_19 AC 146 ms
41,616 KB
testcase_20 AC 148 ms
41,272 KB
testcase_21 AC 142 ms
41,256 KB
testcase_22 AC 146 ms
41,216 KB
testcase_23 AC 147 ms
41,420 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 147 ms
41,404 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 146 ms
41,312 KB
testcase_30 AC 143 ms
41,668 KB
testcase_31 AC 144 ms
41,124 KB
testcase_32 AC 143 ms
41,180 KB
testcase_33 AC 144 ms
40,896 KB
testcase_34 AC 149 ms
41,340 KB
testcase_35 AC 144 ms
41,304 KB
testcase_36 AC 147 ms
41,276 KB
testcase_37 AC 146 ms
41,428 KB
testcase_38 AC 147 ms
41,164 KB
testcase_39 AC 147 ms
41,396 KB
testcase_40 AC 148 ms
41,152 KB
testcase_41 AC 146 ms
41,360 KB
testcase_42 AC 150 ms
41,176 KB
testcase_43 AC 145 ms
41,472 KB
testcase_44 AC 148 ms
41,032 KB
testcase_45 AC 143 ms
41,252 KB
testcase_46 AC 144 ms
41,032 KB
testcase_47 WA -
testcase_48 AC 148 ms
41,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	
	public static final int SIZE = 14;
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final int D = sc.nextInt();
		
		boolean[] days = new boolean[SIZE];
		for(int i = 0; i < 2; i++){
			char[] inputs = sc.next().toCharArray();
			
			for(int j = 0; j < SIZE / 2; j++){
				days[i * (SIZE / 2) + j] = inputs[j] == 'o';
			}
		}
		
		int max = 0;
		for(int d = 0; d <= 3 * SIZE - D; d++){
			boolean[] new_days = new boolean[3 * SIZE];
			System.arraycopy(days, 0, new_days, SIZE, SIZE);
			
			for(int i = 0; i < D; i++){
				new_days[d + i] = true;
			}
			/*
			for(int i = 0; i < SIZE; i++){
				System.out.print(new_days[i] ? "o" : "x");
			}
			System.out.println();
			*/
			
			int prev = -1;
			for(int cur = 0; cur < new_days.length; cur++){
				if(!new_days[cur] && prev >= 0){
					max = Math.max(max, cur - prev);
					prev = -1;
				}
				
				if(new_days[cur] && prev < 0){
					prev = cur;
				}
			}
			
			if(prev >= 0){
				max = Math.max(max, new_days.length - prev);
			}
		}
	
		System.out.println(max);
	}
}
0