Submission #19979259
Source Code Expand
Copy
#include <iostream>#include <bits/stdc++.h>using namespace std;const int N=2e5+100;int inf=0x3f3f3f3f;int mod=1e9+7;typedef long long ll;typedef pair <int ,int>pa;char d[15][15];int judge(int i,int j){int ans=0;if(d[i+1][j]=='.') ans++;if(d[i-1][j]=='.') ans++;if(d[i][j+1]=='.') ans++;if(d[i][j-1]=='.') ans++;if(ans==2) return 1;else return 0;
#include <iostream> #include <bits/stdc++.h> using namespace std; const int N=2e5+100; int inf=0x3f3f3f3f; int mod=1e9+7; typedef long long ll; typedef pair <int ,int>pa; char d[15][15]; int judge(int i,int j) { int ans=0; if(d[i+1][j]=='.') ans++; if(d[i-1][j]=='.') ans++; if(d[i][j+1]=='.') ans++; if(d[i][j-1]=='.') ans++; if(ans==2) return 1; else return 0; } int main() { ios::sync_with_stdio(0);cin.tie(0); int h,w;cin>>h>>w; for(int i=1;i<=h;i++) { cin>>d[i]+1; } int ans=0; for(int i=1;i<=h;i++) { for(int j=1;j<=w;j++) { if(d[i][j]=='#'&&judge(i,j)) ans++; } } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Digital Graffiti |
User | Rebirth |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 767 Byte |
Status | WA |
Exec Time | 8 ms |
Memory | 3652 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:28:17: warning: suggest parentheses around ‘+’ inside ‘>>’ [-Wparentheses] 28 | cin>>d[i]+1; | ~~~~^~
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt |
All | handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_03.txt, oldsample_00.txt, oldsample_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, sample_01.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
handmade_00.txt | WA | 7 ms | 3516 KB |
handmade_01.txt | WA | 5 ms | 3512 KB |
handmade_02.txt | WA | 2 ms | 3612 KB |
handmade_03.txt | AC | 2 ms | 3520 KB |
oldsample_00.txt | WA | 2 ms | 3584 KB |
oldsample_01.txt | WA | 2 ms | 3580 KB |
random_00.txt | WA | 2 ms | 3532 KB |
random_01.txt | WA | 2 ms | 3536 KB |
random_02.txt | WA | 2 ms | 3584 KB |
random_03.txt | WA | 2 ms | 3528 KB |
random_04.txt | WA | 2 ms | 3584 KB |
random_05.txt | WA | 2 ms | 3612 KB |
random_06.txt | WA | 6 ms | 3652 KB |
random_07.txt | WA | 2 ms | 3476 KB |
random_08.txt | WA | 3 ms | 3516 KB |
random_09.txt | WA | 2 ms | 3652 KB |
random_10.txt | WA | 2 ms | 3472 KB |
random_11.txt | WA | 2 ms | 3544 KB |
random_12.txt | WA | 2 ms | 3516 KB |
random_13.txt | WA | 2 ms | 3604 KB |
random_14.txt | WA | 2 ms | 3520 KB |
random_15.txt | WA | 2 ms | 3540 KB |
random_16.txt | WA | 8 ms | 3652 KB |
random_17.txt | WA | 2 ms | 3476 KB |
random_18.txt | AC | 2 ms | 3484 KB |
random_19.txt | WA | 2 ms | 3524 KB |
sample_01.txt | AC | 2 ms | 3648 KB |