Submission #19336


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 pair<pair<double,int>,pii> pdii;
int map[502][502];
double flag[502][502];
double 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));
	double 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 532 ms
Memory 18028 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:15:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:23: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 41 ms 2684 KB
00_mini_02.txt AC 39 ms 2688 KB
00_mini_03.txt AC 39 ms 2688 KB
00_mini_04.txt AC 40 ms 2688 KB
00_mini_05.txt WA 40 ms 2692 KB
00_sample_01.txt AC 100 ms 2696 KB
00_sample_02.txt AC 40 ms 2680 KB
01_rnd_01.txt WA 293 ms 6776 KB
01_rnd_02.txt WA 77 ms 5612 KB
01_rnd_03.txt WA 44 ms 3200 KB
01_rnd_04.txt WA 54 ms 4284 KB
01_rnd_05.txt WA 42 ms 3196 KB
01_rnd_06.txt WA 41 ms 2936 KB
01_rnd_07.txt WA 46 ms 5236 KB
01_rnd_08.txt WA 84 ms 6264 KB
01_rnd_09.txt WA 107 ms 6772 KB
01_rnd_10.txt WA 131 ms 6896 KB
01_rnd_11.txt WA 92 ms 5748 KB
01_rnd_12.txt WA 64 ms 4720 KB
01_rnd_13.txt WA 45 ms 3232 KB
01_rnd_14.txt WA 153 ms 7792 KB
01_rnd_15.txt WA 92 ms 5616 KB
01_rnd_16.txt WA 46 ms 3588 KB
01_rnd_17.txt WA 104 ms 6000 KB
01_rnd_18.txt WA 42 ms 3196 KB
01_rnd_19.txt WA 68 ms 6388 KB
01_rnd_20.txt WA 51 ms 5624 KB
02_maxrnd_01.txt WA 129 ms 6524 KB
02_maxrnd_02.txt WA 107 ms 6528 KB
02_maxrnd_03.txt WA 118 ms 6520 KB
02_maxrnd_04.txt WA 170 ms 7284 KB
02_maxrnd_05.txt WA 125 ms 7276 KB
02_maxrnd_06.txt WA 329 ms 8816 KB
02_maxrnd_07.txt WA 75 ms 6212 KB
02_maxrnd_08.txt WA 67 ms 5948 KB
02_maxrnd_09.txt WA 297 ms 11888 KB
02_maxrnd_10.txt WA 110 ms 7292 KB
02_maxrnd_11.txt WA 265 ms 11876 KB
02_maxrnd_12.txt WA 126 ms 8824 KB
02_maxrnd_13.txt WA 145 ms 8816 KB
02_maxrnd_14.txt WA 191 ms 11892 KB
02_maxrnd_15.txt WA 80 ms 6504 KB
02_maxrnd_16.txt WA 160 ms 8816 KB
02_maxrnd_17.txt WA 151 ms 8808 KB
02_maxrnd_18.txt WA 98 ms 7280 KB
02_maxrnd_19.txt WA 107 ms 8828 KB
03_hard_01.txt WA 299 ms 8808 KB
03_hard_02.txt WA 392 ms 8820 KB
03_hard_03.txt AC 516 ms 18024 KB
03_hard_04.txt AC 527 ms 18028 KB
03_hard_05.txt WA 319 ms 7280 KB
03_hard_06.txt WA 382 ms 7284 KB
03_hard_07.txt AC 525 ms 18020 KB
03_hard_08.txt AC 532 ms 18020 KB
04_open_01.txt AC 296 ms 5752 KB
04_open_02.txt WA 383 ms 7284 KB
05_minihard_01.txt WA 40 ms 2944 KB
05_minihard_02.txt WA 41 ms 2940 KB
05_minihard_03.txt AC 40 ms 2928 KB
05_minihard_04.txt AC 40 ms 2944 KB
05_minihard_05.txt WA 40 ms 2932 KB
05_minihard_06.txt WA 40 ms 2940 KB
05_minihard_07.txt WA 42 ms 2924 KB
05_minihard_08.txt WA 40 ms 2940 KB