結果

問題 No.3263 違法な散歩道
コンテスト
ユーザー 👑 tails
提出日時 2025-09-06 14:50:43
言語 cLay
(20250308-1 + boost 1.90.0)
コンパイル:
clayc _filename_
実行:
./a.out
結果
AC  
実行時間 25 ms / 2,000 ms
+ 685µs
コード長 396 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,028 ms
コンパイル使用メモリ 194,144 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2026-07-14 20:37:02
合計ジャッジ時間 5,501 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
In member function ‘void DijkstraHeap<T>::malloc(int) [with T = int]’,
    inlined from ‘void DijkstraHeap<T>::malloc(int, int) [with T = int]’ at main.cpp:261:11,
    inlined from ‘int main()’ at main.cpp:396:11:
main.cpp:245:33: warning: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  245 |     visited = (char*)std::malloc(N*sizeof(char));
      |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from main.cpp:4:
/usr/include/stdlib.h: In function ‘int main()’:
/usr/include/stdlib.h:672:14: note: in a call to allocation function ‘void* malloc(size_t)’ declared here
  672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
      |              ^~~~~~

ソースコード

diff #
raw source code

int@n,@m,@(u,v)--[m],@k,c[n]{};
rep(k){
	int@a--;
	c[a]=1;
}
graph g;
g.setEdge(n,m,u,v);
DijkstraHeap<int>h;
h.malloc(n*5,1);
h.change(0,0);
while(h.size){
	int a=h.pop();
	int v=h.val[a];
	int b=a%5;
	a/=5;
	rep[g.edge[a]](j,g.es[a]){
		int d=c[j]?b+1:0;
		if(d<5){
			h.change(j*5+d,v+1);
		}
	}
}
unsigned z=-1;
rep(i,5){
	int j=(n-1)*5+i;
	if(h.visited[j]){
		z<?=h.val[j];
	}
}
wt(int(z));
0