Submission #6400062
Source Code Expand
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))
/* const */
const int MOD = 1000000007;
/* alias */
typedef long long ll;
typedef unsigned u;
/* function */
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
if (b != 0)return gcd(b, a % b);
return a;
}
ll Lgcd(ll a, ll b) {
if (b != 0) return Lgcd(b, a % b);
return a;
}
int lcm(int a, int b) {
return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
return a / Lgcd(a, b) * b;
}
/* main */
int main() {
int h, w, f = 1, a[] = { -1,0,1,0 }, b[] = { 0,1,0,-1 };
char s[50][51];
scanf("%d%d", &h, &w);
REP(i, h)scanf("%s", &s[i]);
REP(i, h)REP(j, w) {
if (s[i][j] == '.') continue;
int c = 0;
REP(k, 4) if (s[i + a[k]][j + b[k]] == '#')c = 1;
if (c == 0) f = 0;
}
Yes(f);
return 0;
}
Submission Info
Submission Time
2019-07-16 00:45:05+0900
Task
C - Grid Repainting 2
User
takase
Language
C (GCC 5.4.1)
Score
300
Code Size
1422 Byte
Status
AC
Exec Time
1 ms
Memory
128 KB
Compile Error
./Main.c: In function ‘main’:
./Main.c:53:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[51]’ [-Wformat=]
REP(i, h)scanf("%s", &s[i]);
^
./Main.c:52:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &h, &w);
^
./Main.c:53:11: warning: ignoring return value of ‘scanf’, 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
300 / 300
Status
Set Name
Test Cases
Sample
sample_01.txt, sample_02.txt, sample_03.txt
All
in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name
Status
Exec Time
Memory
in01.txt
AC
1 ms
128 KB
in02.txt
AC
1 ms
128 KB
in03.txt
AC
1 ms
128 KB
in04.txt
AC
1 ms
128 KB
in05.txt
AC
1 ms
128 KB
in06.txt
AC
1 ms
128 KB
in07.txt
AC
1 ms
128 KB
in08.txt
AC
1 ms
128 KB
in09.txt
AC
1 ms
128 KB
in10.txt
AC
1 ms
128 KB
sample_01.txt
AC
1 ms
128 KB
sample_02.txt
AC
1 ms
128 KB
sample_03.txt
AC
1 ms
128 KB