結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
52,840 KB
testcase_01 AC 124 ms
54,128 KB
testcase_02 AC 110 ms
53,012 KB
testcase_03 AC 111 ms
53,080 KB
testcase_04 AC 119 ms
54,212 KB
testcase_05 AC 119 ms
53,816 KB
testcase_06 AC 110 ms
52,544 KB
testcase_07 AC 121 ms
53,972 KB
testcase_08 AC 123 ms
54,108 KB
testcase_09 AC 120 ms
54,036 KB
testcase_10 AC 123 ms
53,976 KB
testcase_11 AC 122 ms
54,180 KB
testcase_12 AC 119 ms
53,940 KB
testcase_13 AC 148 ms
53,028 KB
testcase_14 AC 121 ms
54,016 KB
testcase_15 AC 123 ms
54,412 KB
testcase_16 AC 123 ms
54,400 KB
testcase_17 AC 119 ms
54,040 KB
testcase_18 AC 109 ms
52,816 KB
testcase_19 AC 114 ms
53,608 KB
testcase_20 AC 123 ms
54,108 KB
testcase_21 AC 124 ms
54,232 KB
testcase_22 AC 119 ms
53,984 KB
testcase_23 AC 125 ms
54,000 KB
testcase_24 AC 108 ms
53,048 KB
testcase_25 AC 119 ms
54,024 KB
testcase_26 AC 120 ms
54,244 KB
testcase_27 AC 125 ms
54,300 KB
testcase_28 AC 123 ms
54,092 KB
testcase_29 AC 109 ms
52,864 KB
testcase_30 AC 122 ms
54,228 KB
testcase_31 AC 119 ms
53,988 KB
testcase_32 AC 119 ms
54,136 KB
testcase_33 AC 107 ms
53,016 KB
testcase_34 AC 105 ms
52,812 KB
testcase_35 WA -
testcase_36 AC 106 ms
53,500 KB
testcase_37 AC 121 ms
54,084 KB
testcase_38 AC 110 ms
52,756 KB
testcase_39 AC 112 ms
54,084 KB
testcase_40 WA -
testcase_41 AC 98 ms
52,312 KB
testcase_42 AC 108 ms
52,972 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 102 ms
53,072 KB
testcase_46 AC 109 ms
53,012 KB
testcase_47 AC 113 ms
54,032 KB
testcase_48 AC 106 ms
52,820 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 = 1; d <= D; d++) {
			POS:
			for (int start = 0; start <= 3 * SIZE - D; start++) {
				boolean[] new_days = new boolean[3 * SIZE];
				System.arraycopy(days, 0, new_days, SIZE, SIZE);
				
				for(int i = 0; i < d; i++){
					if(new_days[start + i]){
						continue POS;
					}
				}
				
				for (int i = 0; i < d; i++) {
					new_days[start + i] = true;
				}

				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