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

188 lines
6.4 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 21318 - 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>피아노를 사랑하는 시은이는 매일 아침 피아노 체조를 한다. 시은이는 <em>N</em>개의 악보를 가지고 있으며, 1번부터 <em>N</em>번까지의 번호로 부른다. 각 악보는 1 이상 10<sup>9</sup>&nbsp;이하의&nbsp;정수로 표현되는 난이도를 가지고 있다. 난이도를 나타내는 수가 클수록 어려운 악보이다.&nbsp;1 &le; <em>x&nbsp;</em>&le; <em>y&nbsp;</em>&le; <em>N&nbsp;</em>을 만족하는 두 정수 <em>x</em>, <em>y</em>를 골라 <em>x</em>번부터 <em>y</em>번까지의 악보를 번호 순서대로 연주하는 것이 피아노&nbsp;체조이다.</p>
<p>시은이는 피아노 체조를 할 때, 지금 연주하는 악보가 바로 다음에 연주할 악보보다 어렵다면 실수를 한다.&nbsp;다시 말하자면, <em>i</em>(<em>x</em> &le; <em>i</em> &lt; <em>y</em>)번 악보의 난이도가 <em>i&nbsp;</em>+ 1번&nbsp;악보의 난이도보다 높다면 실수를 한다. 특히,&nbsp;마지막으로 연주하는 <em>y</em>번 악보에선 절대&nbsp;실수하지 않는다.&nbsp;시은이는 오늘도 피아노 체조를 하기 위해 두 정수 <em>x</em><em>y</em>를 골랐고, 문득 궁금한 것이 생겼다. 오늘 할 피아노 체조에서 실수하는 곡은 몇 개나 될까?</p>
</article>
<article class="section">
<h2>입력</h2>
<p>첫 번째 줄에 악보의 개수 <em>N</em>(1 &le;&nbsp;<em>N</em> &le;&nbsp;100,000)이 주어진다.</p>
<p>두 번째 줄에 1번 악보부터 <em>N</em>번 악보까지의 난이도가 공백을 구분으로 주어진다.</p>
<p>세 번째 줄에 질문의 개수 <em>Q</em>(1 &le;&nbsp;<em>Q</em>&nbsp;&le;&nbsp;100,000)이 주어진다.</p>
<p>다음 <em>Q</em>개의 줄에 각 줄마다 두&nbsp;개의 정수 <em>x</em>, <em>y</em>(1 &le;&nbsp;<em>x</em> &le;&nbsp;<em>y</em> &le;&nbsp;<em>N</em>)가 주어진다.</p>
</article>
<article class="section">
<h2>출력</h2>
<p><em>x</em>번부터 <em>y</em>번까지의 악보를 순서대로 연주할 때, 몇 개의 악보에서 실수하게 될지 0&nbsp;이상의 정수 하나로 출력한다. 각 출력은 개행으로 구분한다.</p>
</article>
<article class="section">
<h2>예제 입력 1 복사</h2>
<pre class="sampledata" id="sample-input-1">9
1 2 3 3 4 1 10 8 1
5
1 3
2 5
4 7
9 9
5 9
</pre>
</article>
<article class="section">
<h2>예제 입력 2 복사</h2>
<pre class="sampledata" id="sample-input-2">6
573 33283 5572 346 906 567
5
5 6
1 3
2 2
1 6
3 6
</pre>
</article>
<article class="section">
<h2>예제 출력 1 복사</h2>
<pre class="sampledata" id="sample-output-1">0
0
1
0
3
</pre>
</article>
<article class="section">
<h2>예제 출력 2 복사</h2>
<pre class="sampledata" id="sample-output-2">1
1
0
3
2
</pre>
</article>
</main>
</body>
</html>