Submission #60539560
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<cstdio>
#include<queue>
#include<utility>
int n,m,d,ans;
char c[2005];
bool b[2005][2005];
int step[2005][2005];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
std::deque<std::pair<int,int> >q;
int main(){
scanf("%d%d%d",&n,&m,&d);
for(int i=1;i<=n;i++){
scanf("%s",c+1);
for(int j=1;j<=m;j++){
b[i][j]=(c[j]!='.');
if(c[j]=='H'&&d)q.push_back({i,j}),step[i][j]=d;
if(c[j]=='H')ans++;
}
}
while(q.size()){
int nowx=q.front().first,nowy=q.front().second;
if(nowx<1||nowy<1||nowx>n||nowy>m)return 1;
q.pop_front();
for(int i=0;i<=3;i++){
int xx=nowx+dx[i],yy=nowy+dy[i];
if(xx&&yy&&xx<=n&&yy<=m&&!b[xx][yy]){ans++;
b[xx][yy]=1;//printf("%d %d\n",xx,yy);
if(step[xx][yy])return 1;
step[xx][yy]=step[nowx][nowy]-1;
if(step[xx][yy])q.push_back({xx,yy});
}
}
}
printf("%d",ans);
}
Submission Info
Submission Time |
|
Task |
C - Humidifier 3 |
User |
zhouyihan |
Language |
C++ 17 (gcc 12.2) |
Score |
350 |
Code Size |
1033 Byte |
Status |
AC |
Exec Time |
25 ms |
Memory |
14556 KB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d%d%d",&n,&m,&d);
| ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s",c+1);
| ~~~~~^~~~~~~~~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
350 / 350 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
All |
00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt, 01_test_36.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_01.txt |
AC |
1 ms |
3252 KB |
00_sample_02.txt |
AC |
1 ms |
3060 KB |
00_sample_03.txt |
AC |
1 ms |
3236 KB |
01_test_01.txt |
AC |
22 ms |
14272 KB |
01_test_02.txt |
AC |
22 ms |
13908 KB |
01_test_03.txt |
AC |
25 ms |
13928 KB |
01_test_04.txt |
AC |
24 ms |
14272 KB |
01_test_05.txt |
AC |
25 ms |
14480 KB |
01_test_06.txt |
AC |
25 ms |
14540 KB |
01_test_07.txt |
AC |
25 ms |
14556 KB |
01_test_08.txt |
AC |
25 ms |
14296 KB |
01_test_09.txt |
AC |
24 ms |
14520 KB |
01_test_10.txt |
AC |
25 ms |
14200 KB |
01_test_11.txt |
AC |
2 ms |
4820 KB |
01_test_12.txt |
AC |
4 ms |
5932 KB |
01_test_13.txt |
AC |
1 ms |
3432 KB |
01_test_14.txt |
AC |
3 ms |
7752 KB |
01_test_15.txt |
AC |
4 ms |
5840 KB |
01_test_16.txt |
AC |
6 ms |
5908 KB |
01_test_17.txt |
AC |
6 ms |
7704 KB |
01_test_18.txt |
AC |
16 ms |
11540 KB |
01_test_19.txt |
AC |
13 ms |
11204 KB |
01_test_20.txt |
AC |
1 ms |
3344 KB |
01_test_21.txt |
AC |
4 ms |
5152 KB |
01_test_22.txt |
AC |
6 ms |
9152 KB |
01_test_23.txt |
AC |
6 ms |
9132 KB |
01_test_24.txt |
AC |
6 ms |
9252 KB |
01_test_25.txt |
AC |
4 ms |
5192 KB |
01_test_26.txt |
AC |
6 ms |
8984 KB |
01_test_27.txt |
AC |
6 ms |
9304 KB |
01_test_28.txt |
AC |
6 ms |
9252 KB |
01_test_29.txt |
AC |
1 ms |
3240 KB |
01_test_30.txt |
AC |
1 ms |
3300 KB |
01_test_31.txt |
AC |
1 ms |
3240 KB |
01_test_32.txt |
AC |
1 ms |
3224 KB |
01_test_33.txt |
AC |
11 ms |
10276 KB |
01_test_34.txt |
AC |
19 ms |
13000 KB |
01_test_35.txt |
AC |
19 ms |
13132 KB |
01_test_36.txt |
AC |
19 ms |
12984 KB |