Submission #60763061
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>
#define int long long
int h,w,x,p,q,s[505][505],ans,b[505][505];
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
struct node{
int x,y,n;
bool operator<(const node p)const{
return n>p.n;
}
};
std::priority_queue<node>qu;
signed main(){
scanf("%lld%lld%lld%lld%lld",&h,&w,&x,&p,&q);
for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)scanf("%d",&s[i][j]);
b[p][q]=1,ans=s[p][q];
for(int i=0;i<4;i++){int xx=p+dx[i],yy=q+dy[i];
if(xx<1||yy<1||xx>h||yy>w)continue;
qu.push({xx,yy,s[xx][yy]});
}
while(!qu.empty()){
node now=qu.top();qu.pop();
if(b[now.x][now.y])continue;b[now.x][now.y]=1;
if(1ll*now.n*::x>=ans)break;
ans+=now.n;
for(int i=0;i<4;i++){
int tx=now.x+dx[i],ty=now.y+dy[i];
if(tx<1||ty<1||tx>h||ty>w||b[tx][ty])continue;
qu.push({tx,ty,s[tx][ty]});
}
}
printf("%lld",ans);
}
Submission Info
Submission Time
2024-12-14 13:10:25
Task
E - Takahashi is Slime 2
User
zhouyihan
Language
C++ 20 (gcc 12.2)
Score
0
Code Size
878 Byte
Status
WA
Exec Time
113 ms
Memory
13044 KB
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:15:59: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
15 | for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)scanf("%d",&s[i][j]);
| ~^ ~~~~~~~~
| | |
| | long long int*
| int*
| %lld
Main.cpp:23:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
23 | if(b[now.x][now.y])continue;b[now.x][now.y]=1;
| ^~
Main.cpp:23:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
23 | if(b[now.x][now.y])continue;b[now.x][now.y]=1;
| ^
Main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%lld%lld%lld%lld%lld",&h,&w,&x,&p,&q);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:15:56: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)scanf("%d",&s[i][j]);
| ~~~~~^~~~~~~~~~~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 450
Status
Set Name
Test Cases
Sample
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 01_random_46.txt, 01_random_47.txt, 01_random_48.txt, 01_random_49.txt, 01_random_50.txt, 01_random_51.txt, 01_random_52.txt, 01_random_53.txt, 01_random_54.txt, 01_random_55.txt, 01_random_56.txt, 01_random_57.txt, 01_random_58.txt, 01_random_59.txt, 01_random_60.txt, 01_random_61.txt, 01_random_62.txt, 01_random_63.txt, 01_random_64.txt
Case Name
Status
Exec Time
Memory
00_sample_00.txt
AC
1 ms
3192 KB
00_sample_01.txt
AC
1 ms
3220 KB
00_sample_02.txt
AC
1 ms
3392 KB
01_random_03.txt
WA
109 ms
12916 KB
01_random_04.txt
WA
6 ms
5748 KB
01_random_05.txt
WA
110 ms
13040 KB
01_random_06.txt
WA
9 ms
4272 KB
01_random_07.txt
WA
110 ms
12972 KB
01_random_08.txt
WA
5 ms
4176 KB
01_random_09.txt
WA
112 ms
13044 KB
01_random_10.txt
WA
18 ms
6136 KB
01_random_11.txt
AC
32 ms
5028 KB
01_random_12.txt
WA
1 ms
3196 KB
01_random_13.txt
WA
113 ms
12964 KB
01_random_14.txt
WA
5 ms
4132 KB
01_random_15.txt
WA
32 ms
5280 KB
01_random_16.txt
WA
2 ms
4096 KB
01_random_17.txt
WA
32 ms
5328 KB
01_random_18.txt
WA
3 ms
3448 KB
01_random_19.txt
WA
32 ms
5148 KB
01_random_20.txt
AC
10 ms
4184 KB
01_random_21.txt
WA
32 ms
5180 KB
01_random_22.txt
AC
5 ms
4320 KB
01_random_23.txt
AC
32 ms
5004 KB
01_random_24.txt
WA
7 ms
4132 KB
01_random_25.txt
AC
33 ms
5000 KB
01_random_26.txt
AC
1 ms
3256 KB
01_random_27.txt
AC
25 ms
5080 KB
01_random_28.txt
AC
8 ms
4596 KB
01_random_29.txt
AC
32 ms
5284 KB
01_random_30.txt
AC
11 ms
4256 KB
01_random_31.txt
AC
32 ms
5272 KB
01_random_32.txt
AC
9 ms
3672 KB
01_random_33.txt
AC
32 ms
5160 KB
01_random_34.txt
AC
18 ms
4388 KB
01_random_35.txt
AC
28 ms
5264 KB
01_random_36.txt
AC
3 ms
3720 KB
01_random_37.txt
AC
25 ms
5072 KB
01_random_38.txt
AC
9 ms
4452 KB
01_random_39.txt
AC
32 ms
5148 KB
01_random_40.txt
AC
5 ms
4436 KB
01_random_41.txt
AC
32 ms
5280 KB
01_random_42.txt
AC
10 ms
3992 KB
01_random_43.txt
WA
1 ms
3120 KB
01_random_44.txt
WA
1 ms
3312 KB
01_random_45.txt
WA
1 ms
3244 KB
01_random_46.txt
WA
1 ms
3052 KB
01_random_47.txt
WA
1 ms
3036 KB
01_random_48.txt
WA
1 ms
3248 KB
01_random_49.txt
WA
1 ms
3128 KB
01_random_50.txt
WA
1 ms
3116 KB
01_random_51.txt
WA
1 ms
3188 KB
01_random_52.txt
WA
2 ms
5156 KB
01_random_53.txt
WA
2 ms
5196 KB
01_random_54.txt
WA
2 ms
5280 KB
01_random_55.txt
WA
2 ms
5144 KB
01_random_56.txt
WA
2 ms
5188 KB
01_random_57.txt
WA
1 ms
5020 KB
01_random_58.txt
WA
19 ms
5320 KB
01_random_59.txt
WA
21 ms
5096 KB
01_random_60.txt
WA
20 ms
5156 KB
01_random_61.txt
AC
1 ms
3244 KB
01_random_62.txt
AC
1 ms
3188 KB
01_random_63.txt
AC
1 ms
3248 KB
01_random_64.txt
AC
1 ms
3028 KB