結果
| 問題 |
No.3211 NAND Oracle
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-05-27 22:59:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 128 ms / 2,000 ms |
| コード長 | 951 bytes |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 82,460 KB |
| 実行使用メモリ | 81,260 KB |
| 最終ジャッジ日時 | 2025-05-27 23:22:20 |
| 合計ジャッジ時間 | 5,057 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
Q, K = map(int, input().split())
operations = None
def dfs(A, op):
global operations
if len(op) >= Q:
operations = op.copy()
return
length = len(A[0])
for i in range(length):
for j in range(i + 1, length):
next_A = [None] * len(A)
for k in range(len(A)):
next_A[k] = [*A[k], int(not(A[k][i] and A[k][j]))]
if any(sum(next_A[k]) > K for k in range(len(next_A))):
continue
next_op = op + [(i + 1, j + 1)]
dfs(next_A, next_op)
if K >= 5:
operations = [(1, 2), (2, 3), (1, 4), (1, 5), (1, 5)] + [(6, 7)] * (2 * 10**5)
print("Yes")
for i, j in operations[:Q]:
print(i, j)
else:
dfs([[0, 0], [0, 1], [1, 0], [1, 1]], [])
if operations is None:
print("No")
else:
print("Yes")
for i, j in operations:
print(i, j)