Submission #1174677
Source Code Expand
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
const int H_MAX = 100;
const int W_MAX = 100;
int H, W;
char S[H_MAX][W_MAX + 1];
char T[H_MAX][W_MAX + 1];
char U[H_MAX][W_MAX + 1];
void solve() {
copy(S[0], S[H], T[0]);
REP(i, H) REP(j, W) {
if (S[i][j] != '.') continue;
FOR(di, -1, 1) FOR(dj, -1, 1) {
int i2 = i + di, j2 = j + dj;
if (i2 < 0 || i2 >= H || j2 < 0 || j2 >= W) continue;
T[i2][j2] = '.';
}
}
copy(T[0], T[H], U[0]);
REP(i, H) REP(j, W) {
if (T[i][j] != '#') continue;
FOR(di, -1, 1) FOR(dj, -1, 1) {
int i2 = i + di, j2 = j + dj;
if (i2 < 0 || i2 >= H || j2 < 0 || j2 >= W) continue;
U[i2][j2] = '#';
}
}
if (memcmp(S, U, sizeof(S)) == 0) {
puts("possible");
REP(i, H) puts(T[i]);
} else {
puts("impossible");
}
}
void input() {
scanf("%d%d", &H, &W);
REP(i, H) scanf("%s", S[i]);
}
int main() {
input();
solve();
return 0;
}
Submission Info
Submission Time |
|
Task |
D - 画像処理高橋君 |
User |
nejiko96 |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
1085 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
256 KB |
Compile Error
./Main.cpp: In function ‘void input()’:
./Main.cpp:48:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &H, &W);
^
./Main.cpp:49:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
REP(i, H) scanf("%s", S[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
100 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
example_0.txt, example_1.txt, example_2.txt |
All |
example_0.txt, example_1.txt, example_2.txt, handmade_0.txt, handmade_1.txt, possible_0.txt, possible_1.txt, possible_2.txt, possible_3.txt, possible_4.txt, possible_5.txt, possible_6.txt, possible_7.txt, possible_8.txt, possible_9.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt |
Case Name |
Status |
Exec Time |
Memory |
example_0.txt |
AC |
1 ms |
128 KB |
example_1.txt |
AC |
1 ms |
128 KB |
example_2.txt |
AC |
1 ms |
128 KB |
handmade_0.txt |
AC |
1 ms |
128 KB |
handmade_1.txt |
AC |
1 ms |
128 KB |
possible_0.txt |
AC |
1 ms |
128 KB |
possible_1.txt |
AC |
1 ms |
256 KB |
possible_2.txt |
AC |
1 ms |
128 KB |
possible_3.txt |
AC |
1 ms |
128 KB |
possible_4.txt |
AC |
1 ms |
128 KB |
possible_5.txt |
AC |
1 ms |
128 KB |
possible_6.txt |
AC |
1 ms |
128 KB |
possible_7.txt |
AC |
1 ms |
128 KB |
possible_8.txt |
AC |
1 ms |
256 KB |
possible_9.txt |
AC |
1 ms |
128 KB |
random_0.txt |
AC |
1 ms |
128 KB |
random_1.txt |
AC |
1 ms |
128 KB |
random_2.txt |
AC |
1 ms |
128 KB |
random_3.txt |
AC |
1 ms |
128 KB |
random_4.txt |
AC |
1 ms |
128 KB |
random_5.txt |
AC |
1 ms |
128 KB |
random_6.txt |
AC |
1 ms |
128 KB |
random_7.txt |
AC |
1 ms |
128 KB |
random_8.txt |
AC |
1 ms |
128 KB |
random_9.txt |
AC |
1 ms |
128 KB |