Submission #979504
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
bool mp[10][10];
int h,w;
void dfs(int i,int j){
if(mp[i][j]==0) return;
mp[i][j]=0;
if(mp[i+1][j]) return dfs(i+1,j);
return dfs(i,j+1);
}
int main(){
cin>>h>>w;
string s;
for(int i=0;i<h;i++){
cin>>s;
for(int j=0;j<w;j++)
mp[i][j]=(s[j]!='.');
}
dfs(0,0);
bool f=0;
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
if(mp[i][j]){f=1;break;}
if(f)cout<<"Impossible";
else cout<<"Possible";
cout<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Shik and Stone |
| User | mgr0204 |
| Language | C++14 (GCC 5.4.1) |
| Score | 200 |
| Code Size | 539 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 256 KiB |
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 | 3 ms | 256 KiB |
| 001.txt | AC | 3 ms | 256 KiB |
| 002.txt | AC | 3 ms | 256 KiB |
| 003.txt | AC | 3 ms | 256 KiB |
| 004.txt | AC | 3 ms | 256 KiB |
| 005.txt | AC | 2 ms | 256 KiB |
| 006.txt | AC | 3 ms | 256 KiB |
| 007.txt | AC | 3 ms | 256 KiB |
| 008.txt | AC | 2 ms | 256 KiB |
| 009.txt | AC | 3 ms | 256 KiB |
| 010.txt | AC | 3 ms | 256 KiB |
| 011.txt | AC | 3 ms | 256 KiB |
| 012.txt | AC | 3 ms | 256 KiB |
| 013.txt | AC | 3 ms | 256 KiB |
| 014.txt | AC | 3 ms | 256 KiB |
| 015.txt | AC | 3 ms | 256 KiB |
| 016.txt | AC | 3 ms | 256 KiB |
| 017.txt | AC | 3 ms | 256 KiB |
| 018.txt | AC | 3 ms | 256 KiB |
| example0.txt | AC | 3 ms | 256 KiB |
| example1.txt | AC | 3 ms | 256 KiB |
| example2.txt | AC | 3 ms | 256 KiB |