結果

問題 No.92 逃走経路
ユーザー tailstails
提出日時 2020-10-26 20:04:20
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 956 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 31,308 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 02:49:24
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:13:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   13 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:52:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   52 |         write(1,w,(wbuf+sizeof wbuf)-w);
      |         ^~~~~
main.c:53:9: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
   53 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

char*mmap();
#define RD(v) int v=0;{int c;while(c=*r++-48,c>=0)v=v*10+c;}
#define RDL(v) long v=0;{int c;while(c=*r++-48,c>=0)v=v*10+c;}

char wbuf[1024];

int a[1000],b[1000],c[1000];
int h1[1024],h2[1024];

main(){
	char*r=mmap(0l,32l*1024,1,2,0,0ll);
	RD(n);
	RD(m);
	RD(k);
	for(int i=0;i<m;++i){
		RD(ta); a[i]=ta;
		RD(tb); b[i]=tb;
		RD(tc); c[i]=tc;
	}

	int*hr=h1,*hw=h2;
	for(int t=0;t<k;++t){
		RD(d);
		for(int i=0;i<m;++i){
			if(c[i]==d){
				int ia=a[i];
				int ib=b[i];
				if(hr[ia]==t) hw[ib]=t+1;
				if(hr[ib]==t) hw[ia]=t+1;
			}
		}
		int*tmp=hr; hr=hw; hw=tmp;
	}
	char*w=wbuf+sizeof wbuf;
	int z=0;
	for(int j=n+1;--j;){
		if(hr[j]==k){
			*--w=0x30+j%10;
			*--w=j>=10?0x30+j/10%10:0x20;
			*--w=j>=100?0x31:0x20;
			*--w=0x20;
			++z;
		}
	}
	*--w=10;
	*--w=0x30+z%10;
	*--w=z>=10?0x30+z/10%10:0x20;
	*--w=z>=100?0x31:0x20;
	write(1,w,(wbuf+sizeof wbuf)-w);
	_exit(0);
}
0