Submission #2558146
Source Code Expand
#include <stdio.h> char grid[55][55]; int grid2[55][55]; int main() { int H,W; scanf("%d %d",&H,&W); int i,j,k; for(i=0;i<H;i++){ for(j=0;j<W;j++){ scanf(" %c",&grid[i][j]); } } int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; for(i=0;i<H;i++){ for(j=0;j<W;j++){ if(grid[i][j]=='#'){ grid2[i][j]=1; for(k=0;k<4;k++){ if(0<=i+dy[k]&&i+dy[k]<H&&0<=j+dx[k]&&j+dx[k]<W){ if(grid[i+dy[k]][j+dx[k]]=='#'){ grid2[i+dy[k]][j+dx[k]]=1; break; } } } if(k==4){ printf("No\n"); return 0; } } } } for(i=0;i<H;i++){ for(j=0;j<W;j++){ if((grid[i][j]=='.'&&grid2[i][j]==0) ||(grid[i][j]=='#'&&grid2[i][j]==1)); else{printf("No\n");return 0;} } } printf("Yes\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Grid Repainting 2 |
User | tekitouk |
Language | C (GCC 5.4.1) |
Score | 300 |
Code Size | 803 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:10:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d",&H,&W); ^ ./Main.c:16:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf(" %c",&grid[i][j]); ^
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 |