Submission #1355769


Source Code Expand

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);
	}
	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}
	static IntStream INTS(int l){
		return REPS(l).map(i->getInt());
	}
	
	
	static final int[] dx={-1,0,1,0},dy={0,1,0,-1};
	
	static int h=getInt(),w=getInt();
	public static void main(String[] __){
		char[][] f=REPS(h).mapToObj(i->s.next().toCharArray())
				.toArray(char[][]::new);
		
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				for(int d=0;d<4;d++){
					boolean b=false;
					if(izryt(i+dy[d],j+dx[d])&&f[i+dy[d]][j+dx[d]]=='#'){
						if(b){
							System.out.println("Impossible");
						}
						b=true;
					}
				}
			}
		}
		System.out.println("Possible");
	}
	static boolean izryt(int y,int x){
		return 0<=y&&y<h&&0<=x&&x<w;
	}
}

Submission Info

Submission Time
Task A - Shik and Stone
User fal_rnd
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1028 Byte
Status WA
Exec Time 182 ms
Memory 28244 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 1
WA × 2
AC × 12
WA × 10
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 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
Case Name Status Exec Time Memory
000.txt WA 178 ms 26452 KB
001.txt WA 168 ms 26580 KB
002.txt WA 182 ms 26832 KB
003.txt WA 175 ms 24404 KB
004.txt WA 175 ms 26580 KB
005.txt WA 175 ms 26960 KB
006.txt WA 177 ms 28244 KB
007.txt WA 167 ms 26708 KB
008.txt AC 178 ms 26836 KB
009.txt AC 172 ms 24660 KB
010.txt AC 169 ms 25300 KB
011.txt AC 173 ms 24908 KB
012.txt AC 168 ms 26324 KB
013.txt AC 174 ms 25044 KB
014.txt AC 177 ms 26964 KB
015.txt AC 169 ms 26452 KB
016.txt AC 166 ms 24404 KB
017.txt AC 166 ms 26836 KB
018.txt AC 173 ms 26444 KB
example0.txt AC 165 ms 26452 KB
example1.txt WA 176 ms 26708 KB
example2.txt WA 162 ms 26580 KB