Submission #19363


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]=1000000000;
			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 2031 Byte
Status WA
Exec Time 500 ms
Memory 22000 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 26 ms 4620 KB
00_mini_02.txt AC 28 ms 4596 KB
00_mini_03.txt AC 27 ms 4600 KB
00_mini_04.txt AC 27 ms 4612 KB
00_mini_05.txt WA 27 ms 4596 KB
00_sample_01.txt AC 27 ms 4596 KB
00_sample_02.txt AC 27 ms 4600 KB
01_rnd_01.txt WA 352 ms 11888 KB
01_rnd_02.txt WA 68 ms 9720 KB
01_rnd_03.txt WA 32 ms 5628 KB
01_rnd_04.txt WA 44 ms 7164 KB
01_rnd_05.txt WA 29 ms 5392 KB
01_rnd_06.txt WA 29 ms 4984 KB
01_rnd_07.txt WA 35 ms 7676 KB
01_rnd_08.txt WA 84 ms 10744 KB
01_rnd_09.txt WA 114 ms 11888 KB
01_rnd_10.txt WA 137 ms 12120 KB
01_rnd_11.txt WA 99 ms 10100 KB
01_rnd_12.txt WA 60 ms 8180 KB
01_rnd_13.txt WA 35 ms 5564 KB
01_rnd_14.txt WA 177 ms 14064 KB
01_rnd_15.txt WA 96 ms 9964 KB
01_rnd_16.txt WA 34 ms 6144 KB
01_rnd_17.txt WA 112 ms 10484 KB
01_rnd_18.txt WA 30 ms 5496 KB
01_rnd_19.txt WA 68 ms 10608 KB
01_rnd_20.txt WA 42 ms 8180 KB
02_maxrnd_01.txt WA 120 ms 11256 KB
02_maxrnd_02.txt WA 112 ms 11248 KB
02_maxrnd_03.txt WA 121 ms 11252 KB
02_maxrnd_04.txt WA 187 ms 12780 KB
02_maxrnd_05.txt WA 133 ms 12784 KB
02_maxrnd_06.txt WA 403 ms 15852 KB
02_maxrnd_07.txt WA 70 ms 10480 KB
02_maxrnd_08.txt WA 59 ms 10044 KB
02_maxrnd_09.txt WA 369 ms 21996 KB
02_maxrnd_10.txt WA 113 ms 12772 KB
02_maxrnd_11.txt WA 324 ms 21988 KB
02_maxrnd_12.txt WA 140 ms 15828 KB
02_maxrnd_13.txt WA 168 ms 15852 KB
02_maxrnd_14.txt WA 234 ms 21988 KB
02_maxrnd_15.txt WA 77 ms 11272 KB
02_maxrnd_16.txt WA 177 ms 15848 KB
02_maxrnd_17.txt WA 166 ms 15844 KB
02_maxrnd_18.txt WA 108 ms 12788 KB
02_maxrnd_19.txt WA 123 ms 15860 KB
03_hard_01.txt WA 360 ms 15864 KB
03_hard_02.txt WA 500 ms 15828 KB
03_hard_03.txt AC 214 ms 21992 KB
03_hard_04.txt AC 215 ms 22000 KB
03_hard_05.txt WA 366 ms 12748 KB
03_hard_06.txt WA 454 ms 12788 KB
03_hard_07.txt AC 221 ms 21984 KB
03_hard_08.txt AC 219 ms 21992 KB
04_open_01.txt AC 321 ms 9840 KB
04_open_02.txt WA 454 ms 12776 KB
05_minihard_01.txt WA 28 ms 4832 KB
05_minihard_02.txt WA 29 ms 4884 KB
05_minihard_03.txt AC 27 ms 4852 KB
05_minihard_04.txt AC 27 ms 4860 KB
05_minihard_05.txt WA 27 ms 4884 KB
05_minihard_06.txt WA 28 ms 4860 KB
05_minihard_07.txt WA 27 ms 4880 KB
05_minihard_08.txt WA 28 ms 4856 KB