QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 512 MB Puntuación total: 100

#1645. 3-著色問題

Estadísticas

這是一個輸出限定問題。請注意,你仍然必須提交會印出輸出結果的程式碼,而不是文字檔。

圖的有效 3-著色是指將集合 $\{1, 2, 3\}$ 中的顏色(數字)分配給圖的每個頂點,使得對於圖中的任何邊 $(a, b)$,頂點 $a$ 和 $b$ 的顏色不同。對於一個具有 $n$ 個頂點的圖,最多有 $3^n$ 種這樣的著色方式。

你在一家公司工作,目標是成為建立具有給定數量 3-著色圖的專家。有一天,你得知傍晚將會收到一個訂單,要求製作一個恰好有 $6k$ 種 3-著色的圖。你不知道 $k$ 的確切數值,只知道 $1 \le k \le 500$。

你不想等到 $k$ 的具體數值確定後才開始建立圖。因此,你預先建立一個最多包含 19 個頂點的圖。然後,在得知該特定的 $k$ 值後,你被允許在圖中增加最多 17 條邊,以獲得所需的恰好有 $6k$ 種 3-著色的圖。

你能做到嗎?

輸入格式

本問題沒有輸入。

輸出格式

首先,輸出 $n$ 和 $m$ ($1 \le n \le 19$, $1 \le m \le \frac{n(n-1)}{2}$) —— 初始圖(預先建立的圖)的頂點數和邊數。接著,輸出 $m$ 行,每行格式為 $u \ v$ —— 圖的邊。

接下來,對於每個從 1 到 500 的 $k$,執行以下操作:

輸出 $e$ —— 你為該特定 $k$ 增加的邊數 ($1 \le e \le 17$)。接著,輸出 $e$ 行,每行格式為 $u \ v$ —— 你將增加到圖中的邊。

圖中不能有自環,且對於每個 $k$,你所使用的所有 $m + e$ 條邊必須兩兩相異。該圖對於特定 $k$ 的 3-著色數量必須恰好為 $6k$。

範例

輸入格式 1

(無)

輸出格式 1

3 2
1 2
2 3
1
1 3
1
1 2
... (此處省略 k=3 到 500 的輸出)

說明

範例輸出僅作為範例提供。它包含了 $k = 1, 2$ 的輸出格式。對於每個 $k$,必須輸出 $e$ 以及隨後的 $e$ 行邊。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#309EditorialOpen题解jiangly2025-12-14 07:02:08View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.