Submission #978928
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static System.Console; using Pair = System.Collections.Generic.KeyValuePair<int, int>; namespace AGC007_A { class Program { static bool flag = false; static char[][] A; static int[,] K; static int H, W; static void Main(string[] args) { var t = scan; H = t[0]; W = t[1]; A = new char[H][]; K = new int[H, W]; K[0, 0] = 1; for (int i = 0; i < H; i++) { A[i] = ReadLine().ToCharArray(); } solve(0, 0); //Console.WriteLine(flag); for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (A[i][j] == '#') { if (K[i,j] == 0) { flag = false; } } } } if (flag) { Console.WriteLine("Possible"); } else { Console.WriteLine("Impossible"); } } static void solve(int h, int w) { if (h == H - 1 && w == W - 1) flag = true; if (h + 1 < H && A[h + 1][w] == '#') { solve(h + 1, w); K[h + 1, w] = 1; } else if (w + 1 < W && A[h][w + 1] == '#') { solve(h, w + 1); K[h, w + 1] = 1; } } static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } } } }
Submission Info
Submission Time | |
---|---|
Task | A - Shik and Stone |
User | claw88 |
Language | C# (Mono 4.6.2.0) |
Score | 200 |
Code Size | 1932 Byte |
Status | AC |
Exec Time | 21 ms |
Memory | 2776 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 | 21 ms | 2776 KB |
001.txt | AC | 20 ms | 2776 KB |
002.txt | AC | 20 ms | 2776 KB |
003.txt | AC | 20 ms | 2776 KB |
004.txt | AC | 20 ms | 2776 KB |
005.txt | AC | 20 ms | 2776 KB |
006.txt | AC | 20 ms | 2776 KB |
007.txt | AC | 20 ms | 2776 KB |
008.txt | AC | 20 ms | 2776 KB |
009.txt | AC | 20 ms | 2776 KB |
010.txt | AC | 20 ms | 2776 KB |
011.txt | AC | 20 ms | 2776 KB |
012.txt | AC | 20 ms | 2776 KB |
013.txt | AC | 20 ms | 2776 KB |
014.txt | AC | 20 ms | 2776 KB |
015.txt | AC | 20 ms | 2776 KB |
016.txt | AC | 20 ms | 2776 KB |
017.txt | AC | 20 ms | 2776 KB |
018.txt | AC | 20 ms | 2776 KB |
example0.txt | AC | 20 ms | 2776 KB |
example1.txt | AC | 20 ms | 2776 KB |
example2.txt | AC | 20 ms | 2776 KB |