結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
41,384 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 149 ms
41,156 KB
testcase_05 AC 148 ms
41,612 KB
testcase_06 AC 152 ms
41,240 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 150 ms
41,208 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 149 ms
40,848 KB
testcase_17 AC 147 ms
41,400 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 155 ms
41,308 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 153 ms
41,252 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 155 ms
41,224 KB
testcase_30 AC 151 ms
41,364 KB
testcase_31 AC 150 ms
41,140 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 148 ms
41,008 KB
testcase_35 AC 152 ms
41,300 KB
testcase_36 AC 152 ms
41,044 KB
testcase_37 AC 148 ms
41,240 KB
testcase_38 AC 149 ms
40,760 KB
testcase_39 WA -
testcase_40 AC 148 ms
41,108 KB
testcase_41 AC 148 ms
41,356 KB
testcase_42 WA -
testcase_43 AC 148 ms
41,064 KB
testcase_44 AC 147 ms
41,448 KB
testcase_45 AC 149 ms
41,200 KB
testcase_46 AC 148 ms
41,156 KB
testcase_47 WA -
testcase_48 AC 148 ms
41,120 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 < SIZE - D; d++){
			boolean[] new_days = new boolean[SIZE];
			System.arraycopy(days, 0, new_days, 0, SIZE);
			
			for(int i = 0; i < D; i++){
				new_days[d + i] = true;
			}
			
			int prev = -1;
			for(int cur = 0; cur < SIZE; cur++){
				if(!new_days[cur] && prev >= 0){
					max = Math.max(max, cur - prev);
					prev = -1;
				}else if(new_days[cur] && prev < 0){
					prev = cur;
				}
			}
			
			if(prev >= 0){
				max = Math.max(max, SIZE - prev);
			}
		}
	
		System.out.println(max);
	}
}
0