Submission #19471


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();
		if(zan.first.first==0)
		{
			printf("-1\n");
			break;
		}
		//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 2089 Byte
Status WA
Exec Time 489 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 × 20
WA × 44
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 4636 KB
00_mini_02.txt AC 28 ms 4596 KB
00_mini_03.txt AC 27 ms 4624 KB
00_mini_04.txt AC 33 ms 4628 KB
00_mini_05.txt AC 27 ms 4600 KB
00_sample_01.txt AC 27 ms 4604 KB
00_sample_02.txt AC 27 ms 4600 KB
01_rnd_01.txt WA 352 ms 11876 KB
01_rnd_02.txt WA 69 ms 9708 KB
01_rnd_03.txt WA 32 ms 5624 KB
01_rnd_04.txt WA 46 ms 7164 KB
01_rnd_05.txt WA 30 ms 5368 KB
01_rnd_06.txt WA 27 ms 5108 KB
01_rnd_07.txt WA 35 ms 7636 KB
01_rnd_08.txt WA 84 ms 10740 KB
01_rnd_09.txt WA 117 ms 11884 KB
01_rnd_10.txt WA 139 ms 12148 KB
01_rnd_11.txt WA 95 ms 10092 KB
01_rnd_12.txt WA 59 ms 8188 KB
01_rnd_13.txt WA 35 ms 5576 KB
01_rnd_14.txt WA 178 ms 14064 KB
01_rnd_15.txt WA 95 ms 9836 KB
01_rnd_16.txt WA 34 ms 6136 KB
01_rnd_17.txt AC 93 ms 10476 KB
01_rnd_18.txt AC 29 ms 5244 KB
01_rnd_19.txt AC 34 ms 7292 KB
01_rnd_20.txt AC 31 ms 7320 KB
02_maxrnd_01.txt WA 121 ms 11244 KB
02_maxrnd_02.txt WA 111 ms 11248 KB
02_maxrnd_03.txt WA 125 ms 11260 KB
02_maxrnd_04.txt WA 191 ms 12780 KB
02_maxrnd_05.txt WA 141 ms 12772 KB
02_maxrnd_06.txt WA 412 ms 15856 KB
02_maxrnd_07.txt WA 70 ms 10496 KB
02_maxrnd_08.txt WA 59 ms 10044 KB
02_maxrnd_09.txt WA 356 ms 21960 KB
02_maxrnd_10.txt WA 119 ms 12784 KB
02_maxrnd_11.txt WA 328 ms 21984 KB
02_maxrnd_12.txt WA 144 ms 15840 KB
02_maxrnd_13.txt WA 169 ms 15820 KB
02_maxrnd_14.txt WA 223 ms 21988 KB
02_maxrnd_15.txt WA 76 ms 11248 KB
02_maxrnd_16.txt WA 183 ms 15848 KB
02_maxrnd_17.txt WA 173 ms 15852 KB
02_maxrnd_18.txt AC 59 ms 10052 KB
02_maxrnd_19.txt AC 57 ms 9848 KB
03_hard_01.txt WA 357 ms 15856 KB
03_hard_02.txt WA 489 ms 15840 KB
03_hard_03.txt AC 210 ms 21988 KB
03_hard_04.txt AC 218 ms 21992 KB
03_hard_05.txt WA 384 ms 12788 KB
03_hard_06.txt WA 479 ms 12784 KB
03_hard_07.txt AC 220 ms 21992 KB
03_hard_08.txt AC 222 ms 22000 KB
04_open_01.txt AC 323 ms 9848 KB
04_open_02.txt WA 471 ms 12780 KB
05_minihard_01.txt WA 28 ms 4856 KB
05_minihard_02.txt WA 28 ms 4860 KB
05_minihard_03.txt AC 28 ms 4868 KB
05_minihard_04.txt AC 29 ms 4860 KB
05_minihard_05.txt WA 28 ms 4856 KB
05_minihard_06.txt WA 28 ms 4864 KB
05_minihard_07.txt WA 28 ms 4856 KB
05_minihard_08.txt WA 28 ms 4888 KB