Submission #1355811
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); } public static void main(String[] __){ int h=getInt(),w=getInt(); char[][]f=REPS(h).mapToObj(i->s.next().toCharArray()) .toArray(char[][]::new); int x=0,y=0; while(x!=w-1||y!=h-1) { if(x<w-1&&f[y][x+1]=='#') { f[y][++x]='.'; continue; } if(y<h-1&&f[y+1][x]=='#') { f[++y][x]='.'; continue; } System.out.println("Impossible"); return; } f[0][0]='.'; for(char[] c:f)for(char cc:c) { if(cc=='#') { System.out.println("Impossible"); return; } } System.out.println("Possible"); } }
Submission Info
Submission Time | |
---|---|
Task | A - Shik and Stone |
User | fal_rnd |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 849 Byte |
Status | AC |
Exec Time | 186 ms |
Memory | 29140 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
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 | AC | 172 ms | 29140 KB |
001.txt | AC | 164 ms | 26452 KB |
002.txt | AC | 171 ms | 22864 KB |
003.txt | AC | 186 ms | 26836 KB |
004.txt | AC | 169 ms | 26324 KB |
005.txt | AC | 175 ms | 24788 KB |
006.txt | AC | 175 ms | 25168 KB |
007.txt | AC | 179 ms | 26832 KB |
008.txt | AC | 185 ms | 26580 KB |
009.txt | AC | 165 ms | 24660 KB |
010.txt | AC | 163 ms | 26836 KB |
011.txt | AC | 170 ms | 26964 KB |
012.txt | AC | 175 ms | 26832 KB |
013.txt | AC | 169 ms | 26452 KB |
014.txt | AC | 177 ms | 24780 KB |
015.txt | AC | 179 ms | 27220 KB |
016.txt | AC | 178 ms | 26964 KB |
017.txt | AC | 185 ms | 26836 KB |
018.txt | AC | 173 ms | 26964 KB |
example0.txt | AC | 167 ms | 26708 KB |
example1.txt | AC | 173 ms | 25300 KB |
example2.txt | AC | 173 ms | 26708 KB |