結果
問題 | No.1382 Travel in Mitaru city |
ユーザー | vwxyz |
提出日時 | 2023-11-30 12:12:24 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 825 ms / 2,000 ms |
コード長 | 1,348 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 40,696 KB |
最終ジャッジ日時 | 2024-09-26 13:55:23 |
合計ジャッジ時間 | 30,925 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
11,776 KB |
testcase_01 | AC | 42 ms
11,904 KB |
testcase_02 | AC | 42 ms
11,776 KB |
testcase_03 | AC | 41 ms
11,776 KB |
testcase_04 | AC | 41 ms
11,904 KB |
testcase_05 | AC | 42 ms
11,904 KB |
testcase_06 | AC | 285 ms
21,504 KB |
testcase_07 | AC | 233 ms
18,944 KB |
testcase_08 | AC | 139 ms
15,744 KB |
testcase_09 | AC | 304 ms
22,016 KB |
testcase_10 | AC | 294 ms
21,632 KB |
testcase_11 | AC | 501 ms
27,164 KB |
testcase_12 | AC | 509 ms
27,416 KB |
testcase_13 | AC | 535 ms
27,928 KB |
testcase_14 | AC | 461 ms
26,392 KB |
testcase_15 | AC | 480 ms
26,508 KB |
testcase_16 | AC | 781 ms
35,504 KB |
testcase_17 | AC | 765 ms
35,384 KB |
testcase_18 | AC | 763 ms
35,380 KB |
testcase_19 | AC | 762 ms
34,996 KB |
testcase_20 | AC | 752 ms
35,500 KB |
testcase_21 | AC | 763 ms
34,740 KB |
testcase_22 | AC | 754 ms
34,736 KB |
testcase_23 | AC | 760 ms
35,128 KB |
testcase_24 | AC | 755 ms
35,380 KB |
testcase_25 | AC | 754 ms
34,992 KB |
testcase_26 | AC | 765 ms
34,772 KB |
testcase_27 | AC | 769 ms
34,612 KB |
testcase_28 | AC | 768 ms
34,712 KB |
testcase_29 | AC | 769 ms
34,768 KB |
testcase_30 | AC | 778 ms
34,704 KB |
testcase_31 | AC | 433 ms
30,148 KB |
testcase_32 | AC | 522 ms
33,828 KB |
testcase_33 | AC | 486 ms
32,292 KB |
testcase_34 | AC | 331 ms
25,948 KB |
testcase_35 | AC | 231 ms
21,404 KB |
testcase_36 | AC | 341 ms
30,356 KB |
testcase_37 | AC | 91 ms
14,720 KB |
testcase_38 | AC | 381 ms
32,296 KB |
testcase_39 | AC | 125 ms
17,176 KB |
testcase_40 | AC | 295 ms
27,264 KB |
testcase_41 | AC | 314 ms
29,188 KB |
testcase_42 | AC | 380 ms
32,724 KB |
testcase_43 | AC | 337 ms
30,008 KB |
testcase_44 | AC | 156 ms
19,100 KB |
testcase_45 | AC | 307 ms
28,272 KB |
testcase_46 | AC | 205 ms
19,532 KB |
testcase_47 | AC | 751 ms
38,672 KB |
testcase_48 | AC | 522 ms
30,660 KB |
testcase_49 | AC | 825 ms
40,696 KB |
testcase_50 | AC | 357 ms
24,900 KB |
testcase_51 | AC | 451 ms
30,972 KB |
testcase_52 | AC | 515 ms
34,252 KB |
testcase_53 | AC | 140 ms
17,008 KB |
testcase_54 | AC | 247 ms
22,280 KB |
testcase_55 | AC | 500 ms
33,428 KB |
testcase_56 | AC | 184 ms
19,412 KB |
testcase_57 | AC | 335 ms
26,276 KB |
testcase_58 | AC | 86 ms
14,464 KB |
testcase_59 | AC | 183 ms
19,032 KB |
testcase_60 | AC | 481 ms
32,756 KB |
testcase_61 | AC | 53 ms
12,160 KB |
testcase_62 | AC | 41 ms
11,776 KB |
testcase_63 | AC | 97 ms
12,800 KB |
testcase_64 | AC | 57 ms
12,160 KB |
testcase_65 | AC | 43 ms
12,032 KB |
testcase_66 | AC | 50 ms
12,032 KB |
testcase_67 | AC | 55 ms
12,032 KB |
testcase_68 | AC | 63 ms
12,160 KB |
testcase_69 | AC | 50 ms
12,160 KB |
testcase_70 | AC | 67 ms
12,288 KB |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') #sys.set_int_max_str_digits(10**9) N,M,S,T=map(int,readline().split()) S-=1;T-=1 P=list(map(int,readline().split())) for i in range(N): P[i]-=1 graph=[[] for x in range(N)] for m in range(M): a,b=map(int,readline().split()) a-=1;b-=1 graph[a].append(b) graph[b].append(a) queue=[(P[S],S)] seen=[False]*N seen[S]=True Y=[-1]*N y=0 x=P[S] while queue: p,a=_heappop_max(queue) if x>P[a]: x=P[a] y+=1 Y[a]=y for b in graph[a]: if seen[b]: continue _heappush_max(queue,(P[b],b)) seen[b]=True ans=max(Y) print(ans)