結果

問題 No.340 雪の足跡
ユーザー tailstails
提出日時 2016-01-29 23:22:10
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 914 bytes
コンパイル時間 3,084 ms
コンパイル使用メモリ 162,400 KB
実行使用メモリ 4,600 KB
最終ジャッジ日時 2023-10-21 17:28:13
合計ジャッジ時間 14,692 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,348 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 WA -
testcase_22 AC 2 ms
4,348 KB
testcase_23 WA -
testcase_24 TLE -
testcase_25 AC 687 ms
4,600 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 TLE -
testcase_36 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 入力時間を計る実験

#include<bits/stdc++.h>
using namespace std;

int w,h,n;
priority_queue<int> q;
char p[1000000];
bool v[1000000];

void add(int a,int b){
	int c=a%w==b%w?2:1;
	int d=a%w==b%w?w:1;
	for(int e=min(a,b);e<a||e<b;e+=d){
		p[e]|=c;
	}
}

void enq(int x,int y,int z){
	if(!v[x+y*w]){
		v[x+y*w]=true;
		q.push(x|y<<10|-z<<20);
	}
}

int main(){
	cin>>w>>h>>n;
	for(int i=0;i<n;++i){
		int m,a,b;
		cin>>m>>a;
		for(int j=0;j<m;++j){
			cin>>b;
			add(a,b);
			a=b;
		}
	}
#if 0
	enq(0,0,w+h-2);
	while(!q.empty()){
		int a=q.top();
		q.pop();
		int x=a&0x3ff;
		int y=a>>10&0x3ff;
		int z=-(a>>20);
		if(x==w-1&&y==h-1){
			cout<<z;
			exit(0);
		}
		if(y>0 && p[x+(y-1)*w]&2){
			enq(x,y-1,z+2);
		}
		if(y<h-1 && p[x+y*w]&2){
			enq(x,y+1,z);
		}
		if(x>0 && p[(x-1)+y*w]&1){
			enq(x-1,y,z+2);
		}
		if(x<w-1 && p[x+y*w]&1){
			enq(x+1,y,z);
		}
	}
#endif
	cout<<"Odekakedekinai..";
}
0