結果
問題 | No.2202 贅沢てりたまチキン |
ユーザー |
![]() |
提出日時 | 2023-03-23 23:31:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,648 ms / 2,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 103,424 KB |
最終ジャッジ日時 | 2024-09-18 15:44:02 |
合計ジャッジ時間 | 15,360 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
import sys sys.setrecursionlimit(10**6) n,m = map(int,input().split()) ue=[[] for i in range(n)] shita=[[] for i in range(n)] for i in range(m): x,y=map(int,input().split()) x-=1 y-=1 ue[x].append(y) shita[y].append(x) ue[y].append(x) shita[x].append(y) fu = [0]*n fs = [0]*n def cal(x,f): if f == 0: fu[x] = 1 for i in ue[x]: if fs[i] == 0: cal(i,1) else: fs[x] = 1 for i in shita[x]: if fu[i] == 0: cal(i,0) for i in range(n): if fu[i] == 0 and fs[i] == 0: cal(i,0) if all(fu) and all(fs): print('Yes') else: print('No')