結果

問題 No.3092 3-2-SAT
ユーザー googol_S0googol_S0
提出日時 2022-04-01 21:33:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 89,936 KB
最終ジャッジ日時 2023-08-12 18:07:12
合計ジャッジ時間 4,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,080 KB
testcase_01 AC 132 ms
81,304 KB
testcase_02 AC 160 ms
84,320 KB
testcase_03 AC 144 ms
82,164 KB
testcase_04 AC 210 ms
89,936 KB
testcase_05 AC 152 ms
83,072 KB
testcase_06 AC 152 ms
83,680 KB
testcase_07 AC 181 ms
86,812 KB
testcase_08 AC 139 ms
81,852 KB
testcase_09 AC 161 ms
83,304 KB
testcase_10 AC 125 ms
79,976 KB
testcase_11 AC 74 ms
71,292 KB
testcase_12 AC 72 ms
71,568 KB
testcase_13 AC 75 ms
71,192 KB
testcase_14 AC 73 ms
71,524 KB
testcase_15 AC 75 ms
71,372 KB
testcase_16 AC 76 ms
71,088 KB
testcase_17 AC 74 ms
71,364 KB
testcase_18 AC 73 ms
71,596 KB
testcase_19 AC 76 ms
71,312 KB
testcase_20 AC 74 ms
71,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
ANS=[1]*N
Q=[list(map(int,input().split())) for i in range(M)]
for i in range(M):
  Q[i][0]-=1
  Q[i][1]-=1
  if (not(1<=Q[i][2]<=3)) and (not(1<=Q[i][3]<=3)):
    print(-1)
    exit()
  if (not(1<=Q[i][2]<=3)):
    ANS[Q[i][1]]=Q[i][3]
  if (not(1<=Q[i][3]<=3)):
    ANS[Q[i][0]]=Q[i][2]
for i in range(M):
  if ANS[Q[i][0]]!=Q[i][2] and ANS[Q[i][1]]!=Q[i][3]:
    print(-1)
    exit()
print(*ANS)
0