結果
問題 | No.1 道のショートカット |
ユーザー | MiyamonY |
提出日時 | 2019-09-09 18:25:00 |
言語 | Scheme (Gauche-0.9.14) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,449 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 6,812 KB |
実行使用メモリ | 31,616 KB |
最終ジャッジ日時 | 2024-07-08 05:17:16 |
合計ジャッジ時間 | 11,594 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 63 ms
24,704 KB |
testcase_01 | AC | 61 ms
24,832 KB |
testcase_02 | AC | 59 ms
24,960 KB |
testcase_03 | AC | 60 ms
24,832 KB |
testcase_04 | AC | 58 ms
24,576 KB |
testcase_05 | AC | 60 ms
24,832 KB |
testcase_06 | AC | 57 ms
24,832 KB |
testcase_07 | AC | 62 ms
24,832 KB |
testcase_08 | AC | 721 ms
31,408 KB |
testcase_09 | AC | 309 ms
31,488 KB |
testcase_10 | AC | 245 ms
31,364 KB |
testcase_11 | AC | 359 ms
31,376 KB |
testcase_12 | AC | 916 ms
31,308 KB |
testcase_13 | AC | 905 ms
31,312 KB |
testcase_14 | AC | 107 ms
27,776 KB |
testcase_15 | AC | 59 ms
24,704 KB |
testcase_16 | AC | 130 ms
30,660 KB |
testcase_17 | AC | 62 ms
25,088 KB |
testcase_18 | WA | - |
testcase_19 | AC | 109 ms
27,648 KB |
testcase_20 | AC | 171 ms
31,460 KB |
testcase_21 | AC | 140 ms
30,260 KB |
testcase_22 | AC | 96 ms
27,648 KB |
testcase_23 | AC | 769 ms
31,312 KB |
testcase_24 | AC | 896 ms
31,456 KB |
testcase_25 | AC | 262 ms
31,616 KB |
testcase_26 | AC | 226 ms
31,396 KB |
testcase_27 | AC | 673 ms
31,468 KB |
testcase_28 | AC | 63 ms
25,216 KB |
testcase_29 | AC | 167 ms
31,488 KB |
testcase_30 | AC | 76 ms
27,592 KB |
testcase_31 | AC | 136 ms
31,272 KB |
testcase_32 | WA | - |
testcase_33 | AC | 325 ms
31,440 KB |
testcase_34 | WA | - |
testcase_35 | AC | 71 ms
27,136 KB |
testcase_36 | WA | - |
testcase_37 | AC | 72 ms
27,392 KB |
testcase_38 | AC | 64 ms
27,368 KB |
testcase_39 | AC | 119 ms
27,904 KB |
testcase_40 | AC | 74 ms
27,008 KB |
testcase_41 | AC | 63 ms
25,472 KB |
testcase_42 | AC | 58 ms
24,704 KB |
testcase_43 | AC | 59 ms
24,832 KB |
ソースコード
(use gauche.array) (use data.queue) (define (read-number) (string->number (read-line))) (define (read-numbers) (map string->number (string-split (read-line) #\space))) (let* ((n (read-number)) (c (read-number)) (v (read-number)) (s (read-numbers)) (t (read-numbers)) (y (read-numbers)) (m (read-numbers))) (define graph (make-vector (+ n 1) '())) (define visited (make-vector (+ n 1) #f)) (define times (make-array (shape 0 (+ n 1) 0 (+ c 1)) (ash 1 30))) (define q (make-queue)) (for-each (lambda (x y z w) (vector-set! graph x (cons (cons y (cons z w)) (vector-ref graph x '())))) s t y m) (array-set! times 1 0 0) (queue-push! q 1) (let loop () (unless (queue-empty? q) (let1 from (dequeue! q) (let inner ((nodes (vector-ref graph from))) (unless (null? nodes) (let* ((node (car nodes)) (to (car node)) (cost (cadr node)) (time (cddr node))) (for-each (lambda (i) (if (>= (- i cost) 0) (let1 t (+ time (array-ref times from (- i cost))) (if (<= t (array-ref times to i)) (array-set! times to i t))))) (iota (+ c 1))) (unless (vector-ref visited to) (enqueue! q to) (vector-set! visited to #t))) (inner (cdr nodes))))) (loop))) (let1 val (apply min (map (lambda (i) (array-ref times n i)) (iota (+ c 1)))) (print (if (= val (ash 1 30)) -1 val))))