結果
問題 | No.274 The Wall |
ユーザー | iehn_ |
提出日時 | 2020-08-14 10:29:53 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,234 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 82,288 KB |
実行使用メモリ | 600,312 KB |
最終ジャッジ日時 | 2024-10-10 11:33:11 |
合計ジャッジ時間 | 8,864 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 152 ms
96,344 KB |
testcase_01 | AC | 156 ms
89,648 KB |
testcase_02 | AC | 147 ms
89,964 KB |
testcase_03 | TLE | - |
testcase_04 | AC | 151 ms
89,564 KB |
testcase_05 | AC | 148 ms
89,840 KB |
testcase_06 | AC | 148 ms
89,416 KB |
testcase_07 | AC | 149 ms
89,672 KB |
testcase_08 | AC | 148 ms
89,524 KB |
testcase_09 | AC | 149 ms
89,876 KB |
testcase_10 | AC | 150 ms
90,196 KB |
testcase_11 | MLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
ソースコード
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools import time,random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def JA(a, sep): return sep.join(map(str, a)) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def scc(n, e, re): v = [None] * n t = [] def dfs(i): v[i] = 0 for b in e[i]: if v[b] is None: dfs(b) t.append(i) for i in range(n): if v[i] is None: dfs(i) r = [None] * n def dfs2(i, p): r[i] = p for b in re[i]: if r[b] is None: dfs2(b, p) for c in t[::-1]: if r[c] is None: dfs2(c, c) return r def main(): n,m = LI() lr = [LI() for _ in range(n)] e = collections.defaultdict(set) re = collections.defaultdict(set) def f(i,ni,li,ri,j,nj,lj,rj): if li<=lj<=ri or li<=rj<=ri or lj<=li<=rj: e[i].add(nj) re[nj].add(i) e[j].add(ni) re[ni].add(j) for i in range(n): li,ri = lr[i] rli,rri = m-ri-1,m-li-1 for j in range(i+1,n): lj,rj = lr[j] rlj,rrj = m-rj-1,m-lj-1 f(i,i+n,li,ri,j,j+n,lj,rj) f(i,i+n,li,ri,j+n,j,rlj,rrj) f(i+n,i,rli,rri,j,j+n,lj,rj) f(i+n,i,rli,rri,j+n,j,rlj,rrj) r = scc(n*2,e,re) for i in range(n): if r[i] == r[i+n]: return "NO" return "YES" # start = time.time() print(main()) # pe(time.time() - start)