結果
| 問題 | No.3211 NAND Oracle |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-05-27 22:59:15 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 107 ms / 2,000 ms |
| + 957µs | |
| コード長 | 951 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 95,728 KB |
| 実行使用メモリ | 89,372 KB |
| 最終ジャッジ日時 | 2026-07-11 02:57:32 |
| 合計ジャッジ時間 | 7,534 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)