AtCoder Grand Contest 007

Submission #1355782

Source codeソースコード

import java.util.Scanner;
import java.util.stream.IntStream;
 
public class Main{
	static final Scanner s=new Scanner(System.in);
	static int getInt(){
		return Integer.parseInt(s.next());
	}
	static IntStream REPS(int r){
		return IntStream.range(0,r);
	}
	public static void main(String[] __){
		int h=getInt(),w=getInt();
		char[][]f=REPS(h).mapToObj(i->s.next().toCharArray())
				.toArray(char[][]::new);
		for(int x=0;x<w;x++)for(int y=0;y<h;y++)if(f[y][x]=='#'){
			boolean bx=x<w-1&&f[y][x+1]=='#';
			boolean by=y<h-1&&f[y+1][x]=='#';
			
			if(bx==by) {
				System.out.println("Impossible");
				return;
			}
			if(bx)
				x++;
			if(by)
				y++;
			f[y][x]='.';
		}
		System.out.println("Possible");
	}
}

Submission

Task問題 A - Shik and Stone
User nameユーザ名 ふぁる
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 WA
Score得点 0
Source lengthソースコード長 746 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - example0.txt,example1.txt,example2.txt
All 0 / 200 000.txt,001.txt,002.txt,003.txt,004.txt,005.txt,006.txt,007.txt,008.txt,009.txt,010.txt,011.txt,012.txt,013.txt,014.txt,015.txt,016.txt,017.txt,018.txt,example0.txt,example1.txt,example2.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
000.txt AC 176 ms 26700 KB
001.txt AC 180 ms 24784 KB
002.txt AC 180 ms 24652 KB
003.txt AC 168 ms 24916 KB
004.txt AC 167 ms 26576 KB
005.txt AC 166 ms 24660 KB
006.txt AC 181 ms 24660 KB
007.txt AC 182 ms 26704 KB
008.txt WA
009.txt WA
010.txt WA
011.txt WA
012.txt WA
013.txt AC 165 ms 24660 KB
014.txt AC 173 ms 26960 KB
015.txt AC 166 ms 24148 KB
016.txt AC 175 ms 24400 KB
017.txt WA
018.txt AC 165 ms 24532 KB
example0.txt AC 175 ms 26708 KB
example1.txt AC 172 ms 26708 KB
example2.txt AC 163 ms 26452 KB