%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Programming/Coding Assignment
% LaTeX Template
%
% This template has been downloaded from:
% http://www.latextemplates.com
%
% Original author:
% Ted Pavlic (http://www.tedpavlic.com)
% License : CC Attribution-NC-SA 3.0.
% Read LICENSE for more information.
%
% Specially edited for competitive programming problem description
% by koosaga(http://koosaga.com), seungwonpark(http://swpark.me)
%
% GitHub repository for this template (currently(2017.05.21) private) :
% https://github.com/seungwonpark/PS-latex-template
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage[hangul]{kotex} % Required for using Korean
\usepackage{fancyhdr} % Required for custom headers
\usepackage{lastpage} % Required to determine the last page for the footer
\usepackage{extramarks} % Required for headers and footers
\usepackage[usenames,dvipsnames]{color} % Required for custom colors
\usepackage{graphicx} % Required to insert images
\usepackage{listings} % Required for insertion of code
\usepackage{courier} % Required for the courier font
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage{amsthm,amsmath} % Equation typesetting
\usepackage{algorithm, algpseudocode} % algorithm
\usepackage{verbatim} % for commment, verbatim environment
\usepackage{spverbatim} % automatic linebreak verbatim environment
\usepackage{listings} % Required for lstlisting
\lstset{breaklines=true} % Word wrap within listings environment
\lstset{basicstyle = \ttfamily,columns=fullflexible}
\usepackage{hyperref} % Required for using href
\usepackage{pgffor} % Required for using \foreach
\lstset{columns=fullflexible}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\usepackage{datetime} % Used for showing version as last modified time
\yyyymmdddate
\usepackage{multicol}
\setlength{\columnseprule}{0.4pt}
% Margins
\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=9.0in
\headsep=0.25in
\linespread{1.1} % Line spacing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set up the header and footer
\pagestyle{fancy}
\lhead{}
\chead{IOI 2017 겨울학교 - 추가 문제} % Top center head
\rhead{2017년 1월 9일 월요일} % Top right header
\lfoot{\lastxmark} % Bottom left footer
\cfoot{\thepage} % Bottom center footer
\rfoot{Last modified : \today{} \currenttime}
\def\inputdataname{입력} % Name of 'input'
\def\outputdataname{출력} % Name of 'output'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\headrulewidth{0.4pt} % Size of the header rule
\renewcommand\footrulewidth{0.4pt} % Size of the footer rule
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\setcounter{secnumdepth}{0} % Removes default section numbers
\newcounter{homeworkProblemCounter} % Creates a counter to keep track of the number of problems
\newcommand{\iodataNo}[1]{%
\begin{minipage}{\textwidth}
\begin{multicols}{2}
\href{run:input#1.txt}{\inputdataname#1} \\
\rule{\columnwidth}{1pt}
\lstinputlisting[language={}]{input/input#1.txt}
\columnbreak
\href{run:output#1.txt}{\outputdataname#1} \\
\rule{\columnwidth}{1pt}
\lstinputlisting[language={}]{output/output#1.txt}
\end{multicols}
\vspace{\baselineskip}
\end{minipage}
}
\begin{document}
\section{추가 문제 1. 최소 스패닝 트리}
\begin{center}
\textit{엥? 뭐지? 어제 문제 쉬운데...}
\end{center}
조승현 조교 (\textbf{a}inta) 는 어제 자신이 준비한 \textbf{\textit{쉬운}} 모의고사를 만점 받지 못한 여러분에게 실망했다. 여러분들의 실력이 정말 심각하다고 생각한 승현이는 \textbf{\textit{쉬운}} 문제를 준비했다. \newline
조승현 조교가 준비한 문제는 그래프의 ``최소 스패닝 트리'' 를 구하는 문제이다. 정점과 간선이 주어졌을 때, 그래프의 최소 스패닝 트리를 구하면 된다. 조승현 조교는 간선의 가중치를 마음대로 주면 여러분들이 너무 어려워 할까봐, 수열 $p_1, ..., p_n$ 을 주고, 정점 $a$와 정점 $b$ 를 잇는 간선의 가중치를 $p_a + p_b$ 로 고정했다. \newline
아뿔싸, 장난기 많은 윤지학 조교가 조승현 조교의 컴퓨터에 \texttt{sudo rm -rf}를 난사하고 집으로 도망갔다. 조승현 조교는 깨끗하게 포맷된 자신의 컴퓨터를 보면서 절규하기 시작했다. 급한 대로, 조승현 조교는 다른 문제의 테스트 데이터를 적당히 바꿔서, 최소 스패닝 트리 문제에 적용할 예정이다.
\subsection{입력}
첫 번째 줄에 정점의 수 $n$과, 간선 집합의 수 $m$ 이 주어진다. ($1 \leq n, m \leq 100,000$) \newline
두 번째 줄에 수열 $p_1, ..., p_n$ 이 주어진다. ($0 \leq p_i \leq 10^6$) \newline
이후 $m$ 개의 줄에 간선 집합의 정보가 주어진다. 간선 집합의 정보는 $x_i, a_i, b_i$ 의 형태로 주어지며, 정점 $x_i$와 $a_i, a_i + 1, ..., b_i$ 정점이 $b_i - a_i + 1$ 개의 양방향 간선으로 연결되어 있음을 뜻한다 $x_i < a_i$ 혹은 $b_i < x_i$ 를 만족하며, $a_i \leq b_i$ 이다. 중복 간선이 있을 수 있다. \newline
그래프는 연결되어 있음이 보장된다.
\subsection{출력}
최소 스패닝 트리의 간선 가중치 합을 출력한다.
\subsection{예제}
% Place input text files at 'input/' directory.
% Format : 'input/input%d.txt'
% Place output text files at 'ouput/' directory.
% Format : 'output/output%d.txt'
\iodataNo{1}
\iodataNo{2}
% % Or, you can use for loop as...
% \foreach \i in {1, 2, ..., 10}{
% \iodataNo{\i}
% }
\textbf{예제 2 설명:} (1, 3), (1, 4), (4, 2), (2, 5), (2, 6) 간선을 선택하면 최소 스패닝 트리를 만들 수 있다. \newline
\iodataNo{3}
\newpage
\end{document}
PDF Preview
Create an account to compile and preview