Files
CodeObject/storage/zeta/_static/13193.html
2026-04-27 09:44:16 +09:00

214 lines
7.5 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BOJ 13193 - Offline</title>
<style>
:root {
--bg: #fafaf8;
--paper: #ffffff;
--ink: #1e1f24;
--muted: #6a6d75;
--line: #d8dce3;
--accent: #0d6e6e;
--code-bg: #f4f6fb;
}
* { box-sizing: border-box; }
body {
margin: 0;
background:
radial-gradient(circle at 15% 0%, #f0efe9 0%, transparent 42%),
radial-gradient(circle at 85% 20%, #e7f1f2 0%, transparent 38%),
var(--bg);
color: var(--ink);
font-family: "Noto Sans KR", "Pretendard", "Apple SD Gothic Neo", sans-serif;
line-height: 1.65;
}
main {
max-width: 980px;
margin: 0 auto;
padding: 24px 16px 56px;
}
.header {
background: var(--paper);
border: 1px solid var(--line);
border-radius: 14px;
padding: 18px 20px;
margin-bottom: 18px;
}
.header h1 { margin: 0 0 6px; font-size: 1.5rem; }
.header p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.header a { color: var(--accent); text-decoration: none; }
.section {
background: var(--paper);
border: 1px solid var(--line);
border-radius: 14px;
padding: 16px 18px;
margin-bottom: 14px;
overflow-x: auto;
}
h2 {
margin: 0 0 10px;
font-size: 1.05rem;
color: var(--accent);
border-bottom: 1px solid var(--line);
padding-bottom: 8px;
}
pre, code {
font-family: "JetBrains Mono", "Fira Code", monospace;
background: var(--code-bg);
}
pre {
padding: 12px;
border-radius: 10px;
border: 1px solid #e7ebf2;
overflow: auto;
}
blockquote {
margin: 14px 0;
padding: 16px 16px 14px 22px;
border-left: 4px solid var(--accent);
border-radius: 10px;
background: linear-gradient(90deg, #eef8f8 0%, #f9fdfd 100%);
color: #24313a;
font-weight: 600;
position: relative;
}
blockquote::before {
content: "“";
position: absolute;
left: 8px;
top: 2px;
font-size: 1.35rem;
line-height: 1;
color: #0b5f5f;
opacity: 0.7;
}
blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }
q {
color: #114f50;
font-weight: 700;
background: #edf8f8;
border-radius: 6px;
padding: 0 4px;
}
.math-inline math {
font-size: 1em;
vertical-align: middle;
}
.math-block {
margin: 10px 0;
padding: 8px 10px;
overflow-x: auto;
background: #f8fbff;
border: 1px solid #e2ecf8;
border-radius: 8px;
}
.math-block math {
font-size: 1.04em;
display: block;
}
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: 6px 8px; }
img { max-width: 100%; height: auto; }
</style>
</head>
<body>
<main>
<header class="header">
<h1>Router 2</h1>
</header>
<article class="section">
<h2>문제</h2>
<p>Henry and Hetty were recently hired by a networking company from Piatra Neamț. Their first project is to create a new type of router, the revolutionary Connect Ethernet Operating Interface 2016, comprised of:</p>
<ul>
<li>N input nodes, numbered from 1 to N;</li>
<li>N output nodes, numbered from N+1 to 2&times;N;</li>
<li>K internal nodes, numbered from 2&times;N+1 to 2&times;N+K;</li>
<li>M unidirectional direct connections between pairs of distinct nodes.</li>
</ul>
<p>A node X can send data to a node Y (and hence Y can receive data from X) if:</p>
<ul>
<li>X = Y, or</li>
<li>there exists a node Z such that X can send data to Z and there is a direct connection from node Z to node Y.</li>
</ul>
<p>If a node X can send data to a node Y, and X &ne; Y, then we define a data path from X to Y as a set of direct connections {(A<sub>1</sub>, A<sub>2</sub>), (A<sub>2</sub>, A<sub>3</sub>), &hellip; (A<sub>L-1</sub>, A<sub>L</sub>)} for some L &ge; 2, such that A<sub>1</sub> = X and A<sub>L</sub> = Y.</p>
<p>A router works properly if:</p>
<ul>
<li>Each input node can send data to each output node;</li>
<li>Each input node can receive data only from itself;</li>
<li>Each output node can send data only to itself;</li>
<li>For any two nodes X and Y, if X &ne; Y and X can send data to Y, then Y cannot send data to X;</li>
<li>For any two nodes X and Y, if X &ne; Y and X can send data to Y, then the data path from X to Y is unique. In particular, any two nodes X and Y should be connected by at most 1 direct connection.</li>
</ul>
<p>Like any other electronic device, a router needs electricity to work. Let&#39;s define the power needed to operate a node X as P<sub>X</sub> = IN<sub>X</sub> &times; OUT<sub>X</sub>, where IN<sub>X</sub> is the number of input nodes that can send data to X, and OUT<sub>X</sub> is the number of output nodes that can receive data from X. Let&#39;s define the maximum power used by the router as P<sub>max</sub> = max(P<sub>1</sub>, P<sub>2</sub>, &hellip; P<sub>2&times;N+K</sub>).</p>
<p>The project manager has given Henry and Hetty the technical specifications for building a few test routers, listed in the table below. For each of these specifications, the manager wants a router which:</p>
<ul>
<li>has exactly N input nodes and N output nodes;</li>
<li>uses at most M<sub>lim</sub> direct connections;</li>
<li>uses a maximum power which is at most Plim;</li>
<li>uses at most 500 000 nodes overall (Total nodes = N<sub>tot</sub> = 2&times;N + K &le; 500 000).</li>
</ul>
</article>
<article class="section">
<h2>입력</h2>
<p>On the first and only line, three integers: N, the number of input and output nodes; M<sub>lim</sub>, the maximum number of direct connections allowed; and P<sub>lim</sub>, the maximum power the router uses.</p>
<p>N = 223, M<sub>lim</sub>&nbsp;= 1 000 000, P<sub>lim</sub>&nbsp;=1 000 000</p>
</article>
<article class="section">
<h2>출력</h2>
<p>You will output two integer numbers separated by a space: N<sub>tot</sub> = 2&times;N + K, representing the total number of nodes used to build the router; and M, representing the total number of direct connections used. On each of the following M lines you should output a pair of integers X and Y, meaning a direct connection from node X to node Y was built.</p>
</article>
<article class="section">
<h2>예제 입력 1 복사</h2>
<pre class="sampledata" id="sample-input-1">3 100 200
</pre>
</article>
<article class="section">
<h2>예제 입력 2 복사</h2>
<pre class="sampledata" id="sample-input-2">3 100 200
</pre>
</article>
<article class="section">
<h2>예제 출력 1 복사</h2>
<pre class="sampledata" id="sample-output-1">9 8
1 7
2 7
3 8
7 8
8 4
8 9
9 5
9 6
</pre>
</article>
<article class="section">
<h2>예제 출력 2 복사</h2>
<pre class="sampledata" id="sample-output-2">6 9
1 4
1 5
1 6
2 4
2 5
2 6
3 4
3 5
3 6
</pre>
</article>
</main>
</body>
</html>