結果
問題 | No.2536 同値性と充足可能性 |
ユーザー | ニックネーム |
提出日時 | 2023-11-10 22:42:26 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 682 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 37,764 KB |
最終ジャッジ日時 | 2023-11-10 22:42:34 |
合計ジャッジ時間 | 8,294 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,112 KB |
testcase_01 | AC | 30 ms
10,112 KB |
testcase_02 | AC | 30 ms
10,112 KB |
testcase_03 | AC | 30 ms
10,112 KB |
testcase_04 | AC | 30 ms
10,112 KB |
testcase_05 | AC | 30 ms
10,112 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 30 ms
10,112 KB |
testcase_10 | AC | 29 ms
10,112 KB |
testcase_11 | AC | 29 ms
10,112 KB |
testcase_12 | AC | 30 ms
10,112 KB |
testcase_13 | AC | 29 ms
10,112 KB |
testcase_14 | AC | 29 ms
10,112 KB |
testcase_15 | AC | 29 ms
10,112 KB |
testcase_16 | AC | 29 ms
10,112 KB |
testcase_17 | AC | 33 ms
10,240 KB |
testcase_18 | AC | 34 ms
10,240 KB |
testcase_19 | WA | - |
testcase_20 | AC | 58 ms
10,496 KB |
testcase_21 | AC | 60 ms
11,008 KB |
testcase_22 | AC | 62 ms
11,008 KB |
testcase_23 | AC | 378 ms
20,096 KB |
testcase_24 | AC | 405 ms
20,352 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 625 ms
37,764 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
ソースコード
n,m = map(int,input().split()) adj = [[] for _ in range(n)] ban = [[] for _ in range(n)] g = [0]+[-1]*(n-1); st = [0] for _ in range(m): i,e,j = input().split() i,j = int(i)-1,int(j)-1 if e=="<==>": adj[i].append(j); adj[j].append(i) else: ban[i].append(j); ban[j].append(i) while st: p = st.pop() for c in adj[p]: if g[c]==-1: g[c] = g[p]; st.append(c) elif g[c]!=g[p]: exit(print("No")) for c in ban[p]: if g[c]==-1: g[c] = g[p]^1; st.append(c) elif g[c]==g[p]: exit(print("No")) a = [i+1 for i in range(n) if g[i]==0] b = [i+1 for i in range(n) if g[i]==1] print("Yes"); print(max(len(a),len(b))) print(*a if len(b)<=n//2 else b)