結果
| 問題 |
No.274 The Wall
|
| コンテスト | |
| ユーザー |
Rin
|
| 提出日時 | 2015-09-02 17:40:06 |
| 言語 | Scheme (Gauche-0.9.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,943 bytes |
| コンパイル時間 | 132 ms |
| コンパイル使用メモリ | 6,812 KB |
| 実行使用メモリ | 27,936 KB |
| 最終ジャッジ日時 | 2024-07-18 21:34:27 |
| 合計ジャッジ時間 | 4,792 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 TLE * 1 -- * 14 |
ソースコード
(define (System.out.println x)
(begin
(display x)
(newline)
)
)
(define (make-column M For To)
(let loop(
(i 0)
(foo '())
)
(if (and (>= i For) (<= i To))
(if (< i M)
(loop (+ i 1) (cons 1 foo))
(cons 1 foo)
)
(if (< i M)
(loop (+ i 1) (cons 0 foo))
(cons 0 foo)
)
)
)
)
(define (find2 ls)
(let loop(
(i 0)
)
(if (= i (length ls))
#f
(if (= (list-ref ls i) 2)
#t
(loop (+ i 1))
)
)
)
)
(let (
(N (read))
(M (- (read) 1))
(UsedColumn '())
(Possible? "YES")
)
(let loop(
(i 1)
(For (read))
(To (read))
)
(let (
(column (make-column M For To))
)
(if (null? UsedColumn)
(begin
(set! UsedColumn column)
(loop 2 (read) (read))
)
(if (find2 (map + UsedColumn column))
(if (find2 (map + UsedColumn (reverse column)))
(begin
(set! Possible? "NO")
(if (= i N)
(System.out.println Possible?)
(loop (+ i 1) (read) (read))
)
)
(if (= i N)
(System.out.println Possible?)
(begin
(set! UsedColumn (map + UsedColumn (reverse column)))
(loop (+ i 1) (read) (read))
)
)
)
(if (= i N)
(System.out.println Possible?)
(begin
(set! UsedColumn (map + UsedColumn column))
(loop (+ i 1) (read) (read))
)
)
)
)
)
)
)
Rin