結果

問題 No.455 冬の大三角
ユーザー uafr_csuafr_cs
提出日時 2017-10-30 19:08:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,392 bytes
コンパイル時間 2,178 ms
コンパイル使用メモリ 75,708 KB
実行使用メモリ 57,268 KB
最終ジャッジ日時 2023-08-14 13:17:20
合計ジャッジ時間 16,012 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,644 KB
testcase_01 AC 127 ms
55,708 KB
testcase_02 AC 152 ms
56,212 KB
testcase_03 AC 126 ms
55,960 KB
testcase_04 AC 125 ms
55,688 KB
testcase_05 WA -
testcase_06 AC 124 ms
55,692 KB
testcase_07 AC 126 ms
56,056 KB
testcase_08 AC 266 ms
57,268 KB
testcase_09 AC 126 ms
55,936 KB
testcase_10 WA -
testcase_11 AC 126 ms
55,828 KB
testcase_12 WA -
testcase_13 AC 128 ms
56,172 KB
testcase_14 WA -
testcase_15 AC 127 ms
56,040 KB
testcase_16 WA -
testcase_17 AC 127 ms
55,716 KB
testcase_18 WA -
testcase_19 AC 123 ms
55,748 KB
testcase_20 AC 127 ms
56,008 KB
testcase_21 WA -
testcase_22 AC 127 ms
56,040 KB
testcase_23 AC 126 ms
55,744 KB
testcase_24 AC 128 ms
55,688 KB
testcase_25 AC 126 ms
55,484 KB
testcase_26 AC 128 ms
55,684 KB
testcase_27 WA -
testcase_28 AC 126 ms
56,020 KB
testcase_29 AC 238 ms
56,648 KB
testcase_30 AC 194 ms
56,092 KB
testcase_31 AC 191 ms
55,792 KB
testcase_32 AC 192 ms
55,836 KB
testcase_33 AC 248 ms
56,768 KB
testcase_34 AC 150 ms
56,004 KB
testcase_35 AC 231 ms
56,668 KB
testcase_36 AC 191 ms
55,664 KB
testcase_37 AC 195 ms
56,224 KB
testcase_38 AC 177 ms
55,840 KB
testcase_39 AC 254 ms
56,724 KB
testcase_40 AC 218 ms
56,568 KB
testcase_41 AC 196 ms
56,192 KB
testcase_42 AC 191 ms
55,964 KB
testcase_43 AC 170 ms
56,152 KB
testcase_44 AC 169 ms
54,360 KB
testcase_45 AC 235 ms
56,448 KB
testcase_46 AC 191 ms
56,144 KB
testcase_47 AC 189 ms
56,076 KB
testcase_48 AC 180 ms
56,404 KB
testcase_49 AC 126 ms
56,012 KB
testcase_50 AC 134 ms
55,760 KB
testcase_51 AC 168 ms
55,936 KB
testcase_52 WA -
testcase_53 AC 176 ms
55,908 KB
testcase_54 AC 151 ms
55,992 KB
testcase_55 AC 169 ms
56,164 KB
testcase_56 AC 150 ms
56,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int H = sc.nextInt();
		final int W = sc.nextInt();
		
		boolean[][] block = new boolean[H][W];
		for(int i = 0; i < H; i++){
			final char[] ins = sc.next().toCharArray();
			
			for(int j = 0; j < W; j++){
				block[i][j] = ins[j] == '*';
			}
		}
		
		int fst_x = -1, fst_y = -1, snd_x = -1, snd_y = -1;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(!block[i][j]){ continue; }
				
				if(fst_x < 0){
					fst_x = j;
					fst_y = i;
				}else{
					snd_x = j;
					snd_y = i;
				}
			}
		}
		
		if(H * W <= 4){
			LOOP:
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(block[i][j]){ continue; }
					
					block[i][j] = true; break LOOP;
				}
			}
		}else{
			LOOP:
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					if(block[i][j]){ continue; }
					if(i == fst_y || i == snd_y){ continue; }
					if(j == fst_x || j == snd_x){ continue; }
					
					block[i][j] = true; break LOOP;
				}
			}
		}
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				System.out.print(block[i][j] ? "*" : "-");
			}
			System.out.println();
		}
	}
}
0