Submission #19451


Source Code Expand

Copy
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define mq(A,B,C,D) make_pair(make_pair(A,B),make_pair(C,D))
typedef pair<int,int> pii;
typedef long double ld;
typedef pair<pair<ld,int>,pii> pdii;
int map[502][502];
ld flag[502][502];
ld rui[250000];
int main()
{
	int mx,my;
	scanf("%d%d",&mx,&my);
	int sx,sy,gx,gy;
	for(int i=1;i<=mx;i++)
	{
		for(int j=1;j<=my;j++)
		{
			flag[i][j]=-1;
			char zan;
			scanf(" %c",&zan);
			if(zan=='s')
			{
				sx=i;
				sy=j;
				continue;
			}
			if(zan=='g')
			{
				gx=i;
				gy=j;
				map[i][j]=1000000000;
				continue;
			}
			if(zan=='#')
			{
				map[i][j]=0;
				continue;
			}
			map[i][j]=zan-'0';
		}
	}
	priority_queue<pdii>que;
	que.push(mq(100000000,0,sx,sy));
	ld now=1;
	for(int p=0;p<250000;p++)
	{
		rui[p]=now;
		now*=0.99;
	}
	for(;;)
	{
		if(que.empty())
		{
			printf("-1\n");
			break;
		}
		pdii zan=que.top();
		que.pop();
		//printf("%lf %d %d %d\n",zan.first.first,zan.first.second,zan.second.first,zan.second.second);
		if(zan.second.first==gx&&zan.second.second==gy)
		{
			printf("%.30Lf\n",zan.first.first);
			break;
		}
		if(flag[zan.second.first][zan.second.second]>=zan.first.first)
		{
			continue;
		}
		flag[zan.second.first][zan.second.second]=zan.first.first;
		que.push(mq((min(zan.first.first,rui[zan.first.second+1]*map[zan.second.first+1][zan.second.second])),zan.first.second+1,zan.second.first+1,zan.second.second));
		que.push(mq((min(zan.first.first,rui[zan.first.second+1]*map[zan.second.first-1][zan.second.second])),zan.first.second+1,zan.second.first-1,zan.second.second));
		que.push(mq((min(zan.first.first,rui[zan.first.second+1]*map[zan.second.first][zan.second.second+1])),zan.first.second+1,zan.second.first,zan.second.second+1));
		que.push(mq((min(zan.first.first,rui[zan.first.second+1]*map[zan.second.first][zan.second.second-1])),zan.first.second+1,zan.second.first,zan.second.second-1));
	}
}

Submission Info

Submission Time
Task C - 暗闇帰り道
User DEGwer
Language C++ (G++ 4.6.4)
Score 0
Code Size 2022 Byte
Status WA
Exec Time 477 ms
Memory 21996 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:24:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name all
Score / Max Score 0 / 100
Status
AC × 13
WA × 51
Set Name Test Cases
all 00_mini_01.txt, 00_mini_02.txt, 00_mini_03.txt, 00_mini_04.txt, 00_mini_05.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 01_rnd_20.txt, 02_maxrnd_01.txt, 02_maxrnd_02.txt, 02_maxrnd_03.txt, 02_maxrnd_04.txt, 02_maxrnd_05.txt, 02_maxrnd_06.txt, 02_maxrnd_07.txt, 02_maxrnd_08.txt, 02_maxrnd_09.txt, 02_maxrnd_10.txt, 02_maxrnd_11.txt, 02_maxrnd_12.txt, 02_maxrnd_13.txt, 02_maxrnd_14.txt, 02_maxrnd_15.txt, 02_maxrnd_16.txt, 02_maxrnd_17.txt, 02_maxrnd_18.txt, 02_maxrnd_19.txt, 03_hard_01.txt, 03_hard_02.txt, 03_hard_03.txt, 03_hard_04.txt, 03_hard_05.txt, 03_hard_06.txt, 03_hard_07.txt, 03_hard_08.txt, 04_open_01.txt, 04_open_02.txt, 05_minihard_01.txt, 05_minihard_02.txt, 05_minihard_03.txt, 05_minihard_04.txt, 05_minihard_05.txt, 05_minihard_06.txt, 05_minihard_07.txt, 05_minihard_08.txt
Case Name Status Exec Time Memory
00_mini_01.txt AC 28 ms 4632 KB
00_mini_02.txt AC 28 ms 4608 KB
00_mini_03.txt AC 28 ms 4604 KB
00_mini_04.txt AC 27 ms 4596 KB
00_mini_05.txt WA 27 ms 4596 KB
00_sample_01.txt AC 36 ms 4656 KB
00_sample_02.txt AC 27 ms 4604 KB
01_rnd_01.txt WA 359 ms 11892 KB
01_rnd_02.txt WA 70 ms 9728 KB
01_rnd_03.txt WA 32 ms 5612 KB
01_rnd_04.txt WA 45 ms 7156 KB
01_rnd_05.txt WA 30 ms 5392 KB
01_rnd_06.txt WA 28 ms 4984 KB
01_rnd_07.txt WA 34 ms 7676 KB
01_rnd_08.txt WA 83 ms 10748 KB
01_rnd_09.txt WA 113 ms 11892 KB
01_rnd_10.txt WA 136 ms 12152 KB
01_rnd_11.txt WA 94 ms 10100 KB
01_rnd_12.txt WA 60 ms 8176 KB
01_rnd_13.txt WA 36 ms 5572 KB
01_rnd_14.txt WA 178 ms 14048 KB
01_rnd_15.txt WA 93 ms 9844 KB
01_rnd_16.txt WA 34 ms 6144 KB
01_rnd_17.txt WA 114 ms 10480 KB
01_rnd_18.txt WA 31 ms 5500 KB
01_rnd_19.txt WA 68 ms 10620 KB
01_rnd_20.txt WA 42 ms 8184 KB
02_maxrnd_01.txt WA 121 ms 11248 KB
02_maxrnd_02.txt WA 108 ms 11260 KB
02_maxrnd_03.txt WA 124 ms 11248 KB
02_maxrnd_04.txt WA 194 ms 12784 KB
02_maxrnd_05.txt WA 132 ms 12756 KB
02_maxrnd_06.txt WA 391 ms 15812 KB
02_maxrnd_07.txt WA 68 ms 10480 KB
02_maxrnd_08.txt WA 58 ms 10048 KB
02_maxrnd_09.txt WA 373 ms 21988 KB
02_maxrnd_10.txt WA 114 ms 12780 KB
02_maxrnd_11.txt WA 317 ms 21980 KB
02_maxrnd_12.txt WA 136 ms 15848 KB
02_maxrnd_13.txt WA 163 ms 15856 KB
02_maxrnd_14.txt WA 230 ms 21916 KB
02_maxrnd_15.txt WA 76 ms 11252 KB
02_maxrnd_16.txt WA 178 ms 15848 KB
02_maxrnd_17.txt WA 169 ms 15852 KB
02_maxrnd_18.txt WA 105 ms 12784 KB
02_maxrnd_19.txt WA 121 ms 15856 KB
03_hard_01.txt WA 364 ms 15856 KB
03_hard_02.txt WA 477 ms 15844 KB
03_hard_03.txt AC 213 ms 21996 KB
03_hard_04.txt AC 209 ms 21992 KB
03_hard_05.txt WA 382 ms 12780 KB
03_hard_06.txt WA 466 ms 12788 KB
03_hard_07.txt AC 220 ms 21992 KB
03_hard_08.txt AC 219 ms 21992 KB
04_open_01.txt AC 316 ms 9852 KB
04_open_02.txt WA 457 ms 12772 KB
05_minihard_01.txt WA 28 ms 4864 KB
05_minihard_02.txt WA 28 ms 4864 KB
05_minihard_03.txt AC 27 ms 4864 KB
05_minihard_04.txt AC 27 ms 4884 KB
05_minihard_05.txt WA 28 ms 4880 KB
05_minihard_06.txt WA 28 ms 4856 KB
05_minihard_07.txt WA 27 ms 4884 KB
05_minihard_08.txt WA 27 ms 4884 KB