add _static

This commit is contained in:
2026-04-27 09:44:16 +09:00
parent 695760da41
commit fe8128ab65
609 changed files with 107700 additions and 0 deletions

View File

@@ -0,0 +1,198 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BOJ 20929 - 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>중간</h1>
</header>
<article class="section">
<h2>문제</h2>
<p>이 문제는 인터랙티브 문제다.</p>
<p>국렬이는 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>1</mn></mrow></math></span> 이상 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><msup><mn>10</mn><mn>9</mn></msup></mrow></math></span> 이하의 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>N</mi></mrow></math></span>개의 자연수로 이루어진 두 배열 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>A</mi></mrow></math></span>, <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>B</mi></mrow></math></span>를 가지고 있다. 당신은 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>A</mi></mrow></math></span>, <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>B</mi></mrow></math></span>를 합쳤을 때 중간값을 구해야 한다. 중간값은 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>2</mn><mi>N</mi></mrow></math></span>개 수들을 오름차순으로 정렬했을 때 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>N</mi></mrow></math></span>번째 수를 중간값이라고 한다.</p>
<p>국렬이는 인성이 나빠서 배열 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>A</mi></mrow></math></span>, <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>B</mi></mrow></math></span>를 당신에게 제공하지 않을 것이다. 그래도 약간의 자비가 있기에 특정 배열의 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>번째 수가 무엇인지 물어볼 기회를 줬다. 다만 40번까지 질문이 가능하며, 그 이상으로 질문할 경우 국렬이는 <span style="color:#c0392b;"><strong>틀렸습니다</strong></span>로 당신을 때릴 것이다. 답을 출력하는 것은 질문 횟수에 포함되지 않는다.</p>
<p>40번 이하로 질문해서 중간값을 구해보자.</p>
</article>
<article class="section">
<h2>입력</h2>
<p>입력의 첫 줄에 배열의 길이 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>N</mi></mrow></math></span>이 주어진다. <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>N</mi></mrow></math></span><span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><msup><mn>2</mn><mi>k</mi></msup></mrow></math></span>으로 표현할 수 있는 양의 정수만 주어진다. (<span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>0</mn><mo>&#x02264;</mo><mi>k</mi><mo>&#x02264;</mo><mn>19</mn></mrow></math></span>)</p>
</article>
<article class="section">
<h2>출력</h2>
<p>다음 중 하나를 표준 출력 스트림(stdout)으로 한 줄에 출력하여, 배열의 원소를 질문 할 수 있다.</p>
<ul>
<li><span style="color:#e74c3c;"><code>? A x</code></span> : 배열 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>A</mi></mrow></math></span><span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>번째 수 (<span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>1</mn><mo>&#x02264;</mo><mi>x</mi><mo>&#x02264;</mo><mi>N</mi></mrow></math></span>)</li>
<li><span style="color:#e74c3c;"><code>? B x</code></span> : 배열 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>B</mi></mrow></math></span><span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>번째 수 (<span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mn>1</mn><mo>&#x02264;</mo><mi>x</mi><mo>&#x02264;</mo><mi>N</mi></mrow></math></span>)</li>
</ul>
<p>어떤 배열에서 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>번째 수는, 그 배열을 오름차순으로 정렬했을 때 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>번째인 수를 의미한다</p>
<p>각 질문을 출력한 후에는 반드시 표준 출력 버퍼를 flush해 주어야 하고, 표준 입력 스트림(stdin)을 통해 질문에 대한 답을 입력받아야 한다. 질문에 대한 답을 입력받지 않으면 <span style="color:#4e5f70;"><strong>런타임에러</strong></span>를 받게 된다. 최대 질문 횟수는 40번으로, 그 이상으로 질문을 요청한 경우 <span style="color:#c0392b;"><strong>틀렸습니다!</strong></span>를 받는다.</p>
<p>만약 중간값을 알아낸 경우, 표준 출력 스트림으로 다음을 한 줄에 출력한다.</p>
<ul>
<li><span style="color:#e74c3c;"><code>! x</code></span> : 배열 A, B를 합쳤을 때의 중앙값은 <span class="math-inline"><math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>x</mi></mrow></math></span>이다.</li>
</ul>
<p>그 후 반드시 표준 출력 버퍼를 flush해야 하고, 프로그램을 종료한다. 이것은 질문 횟수에 포함되지 않는다.</p>
<p>언어별로 표준 출력 버퍼를 flush하는 방법은 다음과 같다.</p>
<ul>
<li>C: <code>fflush(stdout)</code></li>
<li>C++: <code>std::cout &lt;&lt; std::flush</code></li>
<li>Java: <code>System.out.flush()</code></li>
<li>Python: <code>sys.stdout.flush()</code></li>
</ul>
</article>
<article class="section">
<h2>예제 입력 1 복사</h2>
<pre class="sampledata" id="sample-input-1">2
1
2
2
3
</pre>
</article>
<article class="section">
<h2>예제 출력 1 복사</h2>
<pre class="sampledata" id="sample-output-1">
? A 1
? A 2
? B 1
? B 2
! 2
</pre>
</article>
</main>
</body>
</html>