├── .gitignore
├── 00_introduction.tex
├── 01_quickfire.tex
├── 02_ponder.tex
├── 03_coding.tex
├── CHANGELOG.md
├── LICENSE
├── README.md
├── assets
├── by-nc.eps
├── code-squad.eps
├── code-squad.png
├── techjam-2018.eps
└── techjam-2018.png
├── figures
├── coding_descendingdrills.ipe
├── coding_descendingdrills_01.eps
├── coding_descendingdrills_02.eps
├── coding_descendingdrills_03.eps
├── coding_descendingdrills_04.eps
├── coding_national_findingpeepchan_01.png
├── coding_national_findingpeepchan_02.png
├── coding_national_interceptmeteor.png
├── coding_national_stablemolecule_01.png
├── coding_national_stablemolecule_02.png
├── coding_national_stablemolecule_03.png
├── font-selection.isy
├── kbtg-colors.isy
├── ponder_central_audition_infinitepath.eps
├── ponder_central_audition_infinitepath.ipe
├── ponder_central_regional_cryptarithmetic.eps
├── ponder_central_regional_cryptarithmetic.ipe
├── ponder_central_regional_pizzapaint.ipe
├── ponder_central_regional_pizzapaint_01.eps
├── ponder_central_regional_pizzapaint_02.eps
├── ponder_national_fourbyfour.eps
├── ponder_national_fourbyfour.ipe
├── ponder_national_greedytsp.ipe
├── ponder_national_greedytsp_01.eps
├── ponder_national_greedytsp_02.eps
├── ponder_national_greedytsp_03.eps
├── ponder_national_greedytsp_04.eps
├── ponder_national_picturehang.ipe
├── ponder_national_picturehang_01.eps
├── ponder_national_picturehang_02.eps
├── ponder_national_picturehang_03.eps
├── ponder_national_picturehang_04.eps
├── ponder_national_tetris.eps
├── ponder_national_tetris.ipe
├── quickfire_central_audition_squaretiling.eps
├── quickfire_central_audition_squaretiling.ipe
├── quickfire_central_regional_bfsdfs.eps
├── quickfire_central_regional_bfsdfs.ipe
├── quickfire_central_regional_closedshapearea.ipe
├── quickfire_central_regional_closedshapearea_01.eps
├── quickfire_central_regional_closedshapearea_02.eps
├── quickfire_central_regional_closedshapearea_03.eps
├── quickfire_central_regional_nestbox.eps
├── quickfire_central_regional_nestbox.ipe
├── quickfire_north_audition_validbfs.eps
├── quickfire_north_audition_validbfs.ipe
├── quickfire_north_regional_recursiondepth.ipe
├── quickfire_north_regional_recursiondepth_01.eps
├── quickfire_north_regional_recursiondepth_02.eps
├── svgcolors.isy
└── x11colors.isy
├── fonts
├── FiraCode-Bold.otf
├── FiraCode-Regular.otf
├── FiraGO-Bold.otf
├── FiraGO-Book.otf
├── FiraMono-Bold.otf
├── FiraMono-Regular.otf
├── Kanit-Light.otf
├── Kanit-LightItalic.otf
├── Kanit-SemiBold.otf
├── Kanit-SemiBoldItalic.otf
├── Sarabun-Bold.ttf
├── Sarabun-BoldItalic.ttf
├── Sarabun-ExtraBold.ttf
├── Sarabun-ExtraBoldItalic.ttf
├── Sarabun-ExtraLight.ttf
├── Sarabun-ExtraLightItalic.ttf
├── Sarabun-Italic.ttf
├── Sarabun-Light.ttf
├── Sarabun-LightItalic.ttf
├── Sarabun-Medium.ttf
├── Sarabun-MediumItalic.ttf
├── Sarabun-Regular.ttf
├── Sarabun-SemiBold.ttf
├── Sarabun-SemiBoldItalic.ttf
├── Sarabun-Thin.ttf
└── Sarabun-ThinItalic.ttf
├── main.tex
├── questions01_quickfire
├── central_audition_linearswap.tex
├── central_audition_sortbetweenintro.tex
├── central_audition_squaretiling.tex
├── central_audition_treereducer.tex
├── central_regional_bfsdfs.tex
├── central_regional_closedshapearea.tex
├── central_regional_cssiblings.tex
├── central_regional_nestbox.tex
├── central_regional_sortbetweensuper.tex
├── north_audition_buffaloeasy.tex
├── north_audition_negmaxsum.tex
├── north_audition_validbfs.tex
├── north_regional_buffalomedium.tex
├── north_regional_lockboxes.tex
├── north_regional_pigeoncard.tex
├── north_regional_recursiondepth.tex
├── northeast_audition_betterthanlinear.tex
├── northeast_audition_counteven.tex
├── northeast_audition_parenbalance.tex
├── northeast_regional_fiboratio.tex
├── northeast_regional_whatm.tex
├── south_regional_clocktick.tex
├── south_regional_negmaxsum.tex
├── south_regional_reverseshuffle.tex
└── south_regional_treeheight.tex
├── questions02_ponder
├── central_audition_biasedcoin.tex
├── central_audition_cloudupgrade.tex
├── central_audition_infinitepath.tex
├── central_audition_primepartition.tex
├── central_audition_timecomplexhard.tex
├── central_regional_candy.tex
├── central_regional_comptreeesay.tex
├── central_regional_cryptarithmetic.tex
├── central_regional_intbipartite.tex
├── central_regional_pizzapaint.tex
├── national_3tap.tex
├── national_classroom.tex
├── national_contiguousprimes.tex
├── national_foodchain.tex
├── national_fourbyfour.tex
├── national_greedytsp.tex
├── national_makechange.tex
├── national_picturehang.tex
├── national_tetris.tex
├── national_validatearray.tex
├── national_vault.tex
├── north_audition_randommod.tex
├── north_audition_twosidecoin.tex
├── north_regional_goodtimes.tex
├── north_regional_subsetsum.tex
├── north_regional_sumcell.tex
├── north_regional_trailingzeros.tex
├── northeast_audition_sqroot.tex
├── northeast_audition_timecomplexeasy.tex
├── northeast_regional_licenseplate.tex
├── northeast_regional_maketriangle.tex
├── south_audition_countdigits.tex
├── south_audition_dfsbst.tex
├── south_regional_comptreehard.tex
├── south_regional_iq180p1.tex
└── south_regional_sumofdigits.tex
├── questions03_coding
├── central_regional_descendingdrills.tex
├── central_regional_lobbyingtollway.tex
├── central_regional_polymerchain.tex
├── national_findingpeepchan.tex
├── national_interceptmeteor.tex
├── national_rotatesort.tex
├── national_stablemolecule.tex
├── south_regional_islandcounting.tex
└── south_regional_shippingdolls.tex
└── techjam-codequestions.cls
/.gitignore:
--------------------------------------------------------------------------------
1 | #####################
2 | # TEX related files #
3 | #####################
4 |
5 | ## Core latex/pdflatex auxiliary files:
6 | *.aux
7 | *.lof
8 | *.log
9 | *.lot
10 | *.fls
11 | *.out
12 | *.toc
13 | *.fmt
14 | *.fot
15 | *.cb
16 | *.cb2
17 | .*.lb
18 |
19 | ## Intermediate documents:
20 | *.dvi
21 | *.xdv
22 | *-converted-to.*
23 | # these rules might exclude image files for figures etc.
24 | # *.ps
25 | # *.eps
26 | # *.pdf
27 |
28 | ## Generated if empty string is given at "Please type another file name for output:"
29 | .pdf
30 |
31 | ## Bibliography auxiliary files (bibtex/biblatex/biber):
32 | *.bbl
33 | *.bcf
34 | *.blg
35 | *-blx.aux
36 | *-blx.bib
37 | *.run.xml
38 |
39 | ## Build tool auxiliary files:
40 | *.fdb_latexmk
41 | *.synctex
42 | *.synctex(busy)
43 | *.synctex.gz
44 | *.synctex.gz(busy)
45 | *.pdfsync
46 |
47 | ## Auxiliary and intermediate files from other packages:
48 | # algorithms
49 | *.alg
50 | *.loa
51 |
52 | # achemso
53 | acs-*.bib
54 |
55 | # amsthm
56 | *.thm
57 |
58 | # beamer
59 | *.nav
60 | *.pre
61 | *.snm
62 | *.vrb
63 |
64 | # changes
65 | *.soc
66 |
67 | # cprotect
68 | *.cpt
69 |
70 | # elsarticle (documentclass of Elsevier journals)
71 | *.spl
72 |
73 | # endnotes
74 | *.ent
75 |
76 | # fixme
77 | *.lox
78 |
79 | # feynmf/feynmp
80 | *.mf
81 | *.mp
82 | *.t[1-9]
83 | *.t[1-9][0-9]
84 | *.tfm
85 |
86 | #(r)(e)ledmac/(r)(e)ledpar
87 | *.end
88 | *.?end
89 | *.[1-9]
90 | *.[1-9][0-9]
91 | *.[1-9][0-9][0-9]
92 | *.[1-9]R
93 | *.[1-9][0-9]R
94 | *.[1-9][0-9][0-9]R
95 | *.eledsec[1-9]
96 | *.eledsec[1-9]R
97 | *.eledsec[1-9][0-9]
98 | *.eledsec[1-9][0-9]R
99 | *.eledsec[1-9][0-9][0-9]
100 | *.eledsec[1-9][0-9][0-9]R
101 |
102 | # glossaries
103 | *.acn
104 | *.acr
105 | *.glg
106 | *.glo
107 | *.gls
108 | *.glsdefs
109 |
110 | # gnuplottex
111 | *-gnuplottex-*
112 |
113 | # gregoriotex
114 | *.gaux
115 | *.gtex
116 |
117 | # htlatex
118 | *.4ct
119 | *.4tc
120 | *.idv
121 | *.lg
122 | *.trc
123 | *.xref
124 |
125 | # hyperref
126 | *.brf
127 |
128 | # knitr
129 | *-concordance.tex
130 | # TODO Comment the next line if you want to keep your tikz graphics files
131 | *.tikz
132 | *-tikzDictionary
133 |
134 | # listings
135 | *.lol
136 |
137 | # makeidx
138 | *.idx
139 | *.ilg
140 | *.ind
141 | *.ist
142 |
143 | # minitoc
144 | *.maf
145 | *.mlf
146 | *.mlt
147 | *.mtc[0-9]*
148 | *.slf[0-9]*
149 | *.slt[0-9]*
150 | *.stc[0-9]*
151 |
152 | # minted
153 | _minted*
154 | *.pyg
155 |
156 | # morewrites
157 | *.mw
158 |
159 | # nomencl
160 | *.nlg
161 | *.nlo
162 | *.nls
163 |
164 | # pax
165 | *.pax
166 |
167 | # pdfpcnotes
168 | *.pdfpc
169 |
170 | # sagetex
171 | *.sagetex.sage
172 | *.sagetex.py
173 | *.sagetex.scmd
174 |
175 | # scrwfile
176 | *.wrt
177 |
178 | # sympy
179 | *.sout
180 | *.sympy
181 | sympy-plots-for-*.tex/
182 |
183 | # pdfcomment
184 | *.upa
185 | *.upb
186 |
187 | # pythontex
188 | *.pytxcode
189 | pythontex-files-*/
190 |
191 | # thmtools
192 | *.loe
193 |
194 | # TikZ & PGF
195 | *.dpth
196 | *.md5
197 | *.auxlock
198 |
199 | # todonotes
200 | *.tdo
201 |
202 | # easy-todo
203 | *.lod
204 |
205 | # xmpincl
206 | *.xmpi
207 |
208 | # xindy
209 | *.xdy
210 |
211 | # xypic precompiled matrices
212 | *.xyc
213 |
214 | # endfloat
215 | *.ttt
216 | *.fff
217 |
218 | # Latexian
219 | TSWLatexianTemp*
220 |
221 | ## Editors:
222 | # WinEdt
223 | *.bak
224 | *.sav
225 |
226 | # Texpad
227 | .texpadtmp
228 |
229 | # Kile
230 | *.backup
231 |
232 | # KBibTeX
233 | *~[0-9]*
234 |
235 | # auto folder when using emacs and auctex
236 | ./auto/*
237 | *.el
238 |
239 | # expex forward references with \gathertags
240 | *-tags.tex
241 |
242 | # standalone packages
243 | *.sta
244 |
245 | # generated if using elsarticle.cls
246 | *.spl
247 |
248 | ##########################
249 | # Project-specific files #
250 | ##########################
251 |
252 | .vscode/
253 | .idea/
254 | *.pdf
255 |
--------------------------------------------------------------------------------
/00_introduction.tex:
--------------------------------------------------------------------------------
1 | % !TEX root = main.tex
2 |
3 | \vphantom{}\marginnote{
4 | \includegraphics[width=0.8\linewidth]{assets/techjam-2018.eps}
5 |
6 | \bigskip
7 | \includegraphics[width=0.8\linewidth]{assets/code-squad.eps}
8 | }%
9 | {\techjam}\;\; เป็นการแข่งขันที่จัดขึ้นโดย {\ltspc KBTG} เพื่อเฟ้นหาสุดยอดขุนพลแห่งอนาคตด้าน
10 | \textit{Coding},\, \textit{Data Science} และ\, \textit{Design}
11 | ที่ผู้เข้าร่วมแข่งขันเปรียบเสมือนขุนพลจากทั่วประเทศที่จะนำทักษะความสามารถทางเทคโนโลยีและการออกแบบ
12 | ซึ่งเป็นเครื่องมือสำคัญของยุคสมัยแห่งอนาคต มาประชันกันเพื่อหาสุดยอดฝีมือ
13 |
14 | ในการแข่งขันของกลุ่ม Code Squad นั้นเราต้องการค้นหาสุดยอดฝีมือด้านการเขียนโปรแกรมและพัฒนาซอฟต์แวร์ที่มีความสามารถรอบด้าน\;
15 | เราเชื่อว่านักพัฒนาซอฟต์แวร์ที่ดี นอกจากจำเป็นจะต้องมีทักษะการเขียนโปรแกรมที่เก่งกาจแล้ว
16 | ยังต้องมีความสามารถที่จะเข้าใจและวิเคราะห์ปัญหาในเชิงนามธรรมและระดับโครงสร้างได้
17 | และยังต้องสามารถเลือกใช้วิธีแก้ปัญหาที่เหมาะสมกับเงื่อนไขและตัวแปรข้อจำกัดต่าง ๆ ได้ดีอีกด้วย
18 |
19 | ในการแข่งขัน Code Squad นั้น เราจึงออกแบบโจทย์ให้มีความหลากหลาย ท้าทาย และอาจไม่เคยพบเห็นที่ใดมาก่อน\;
20 | โจทย์แต่ละข้อจะวัดทักษะการเขียนโปรแกรมหรือความรู้ที่เกี่ยวกับการแก้ปัญหาเชิงคำนวณด้วยคอมพิวเตอร์
21 | ตลอดจนไปถึงการนำทักษะและความรู้ดังกล่าวมาแก้ปัญหาที่สลับซับซ้อนมากขึ้น\;
22 | ในขณะเดียวกันนี้เราพยายามปรับสมดุลโจทย์ให้เข้าใจได้ไม่ยาก แต่ยังคงไว้ซึ่งความเข้มข้นของการไขโจทย์ไว้อย่างครบเครื่อง
23 |
24 | ทีมงานได้คัดเลือกโจทย์ที่ใช้แข่งขันของกลุ่ม Code Squad จากงาน {\techjam} นำมารวบรวมและเรียบเรียงไว้ในเอกสารฉบับนี้
25 | เพื่อเป็นประโยชน์แก่นักเรียน นักศึกษา และบุคคลทั่วไปที่สนใจเรื่องการพัฒนาซอฟต์แวร์และการศึกษาที่เกี่ยวกับวิทยาการคำนวณและวิทยาการคอมพิวเตอร์
26 | อันเป็นแรงบันดาลใจให้นักเรียน นักศึกษา นักเขียนโปรแกรมและผู้ที่สนใจในเทคโนโลยีได้ศึกษาค้นคว้าความรู้ต่อไป
27 |
28 | หวังว่าผู้อ่านจะสนุกและเรียนรู้ไปพร้อมกับการแก้ปัญหาโจทย์ปัญหาที่ท้าทายเหล่านี้
29 |
30 | \begin{flushright}
31 | \twoemrule\ ทีมงาน Code Squad, {\techjam}
32 | \end{flushright}
33 |
34 |
35 | \newpage\noindent
36 | {\sectionfont \llap{$\blacklozenge$\; }โจทย์ที่ใช้แข่งขันมีลักษณะอย่างไร?}
37 |
38 | \smallskip\noindent
39 | โจทย์ที่ใช้แข่งขันในกลุ่ม Code Squad นั้นแบ่งออกได้เป็นสามประเภทใหญ่ ๆ คือ
40 |
41 | % TODO: instead of enumeration, use logo from fontawesome
42 | \begin{enumerate}
43 | \item \textbf{Quickfire}\;
44 | เป็นโจทย์ที่ต้องใช้ไหวพริบแล้วความรวดเร็วในการตอบคำถาม ภายในเวลา 10{\hrsp--\hrsp}60 วินาที\;
45 | ผู้เข้าแข่งขัน\textit{ไม่}สามารถใช้คอมพิวเตอร์เพื่อช่วยแก้ปัญหาเหล่านี้ได้
46 | \item \textbf{Ponder}\;
47 | เป็นโจทย์ที่ต้องใช้เวลาในการพิจารณาคำถามและค้นหาคำตอบภายใน 5 นาที\;
48 | ผู้แข่งแข่งขันสามารถใช้คอมพิวเตอร์หรือเทคนิคใด ๆ ก็ได้เพื่อช่วยแก้ปัญหาเหล่านี้ได้\;
49 | หากผู้เข้าแข่งขันสามารถค้นหาคำตอบได้ถูกต้องและรวดเร็วกว่าคนอื่น ๆ ก็จะได้คะแนนสูงขึ้นตามไปด้วย
50 | \item \textbf{Coding}\;
51 | เป็นโจทย์ปัญหาเชิงอัลกอริทึมที่ผู้เข้าแข่งขันต้องเขียนโปรแกรมเพื่อช่วยค้นหาคำตอบอย่างมีประสิทธิภาพ
52 | ตามสเปกที่กำหนด
53 | \end{enumerate}
54 |
55 | \medskip\noindent
56 | {\sectionfont \llap{$\blacklozenge$\; }โจทย์เหล่านี้มีเฉลยหรือไม่?}
57 |
58 | \smallskip\noindent
59 | ถึงแม้ว่าโจทย์เหล่านี้จะมีคำตอบที่ถูกต้องชัดเจนอยู่แล้วทุกข้อ (เว้นคำถามข้อสุดท้าย)
60 | แต่ในขณะนี้ทางทีมงานยังไม่มีแผนที่จะจัดและเผยแพร่เฉลยของโจทย์เหล่านี้อย่างเป็นทางการ
61 |
62 | อย่างไรก็ดีทางทีมงานมีความยินดีเป็นอย่างยิ่ง หากผู้อ่านท่านใดเลือกที่จะนำเสนอวิธีที่ใช้ไขปัญหาโจทย์ข้อต่าง ๆ
63 | ในรูปแบบของบทความหรือสื่ออื่นใด อันจะเป็นประโยชน์แก่สาธารณะได้
64 |
65 |
66 | \vspace*{\fill}
67 |
68 | \begin{small}
69 | \bigskip\noindent
70 | {\textcopyright} สงวนลิขสิทธิ์ 2561{\hrsp--\hrsp}2562\; กสิกร บิซิเนส{\hrsp--\hrsp}เทคโนโลยี กรุ๊ป \\
71 | ตามพระราชบัญญัติลิขสิทธิ์ พุทธศักราช 2537
72 |
73 | \smallskip\noindent
74 | เอกสารฉบับนี้ถูกเผยแพร่ภายใต้สัญญาอนุญาต Creative Commons Attribution--NonCommercial 4.0 International
75 | ซึ่งอนุญาตให้ทำซ้ำ แจกจ่าย หรือแสดงและนำเสนอเอกสารฉบับนี้ และสร้างงานดัดแปลงจากเอกสารฉบับนี้\;
76 | โดยต้องให้เครดิตและแสดงที่มาและไม่ใช้เพื่อการค้า
77 |
78 | \smallskip\noindent
79 | อ่านเงื่อนไขฉบับเต็มได้ที่\; \url{https://creativecommons.org/licenses/by-nc/4.0/}
80 |
81 | \bigskip\noindent
82 | \includegraphics[width=0.190983\linewidth]{assets/by-nc.eps}
83 |
84 | \medskip\noindent
85 | พัฒนาโดยใช้ {\XeLaTeX} เมื่อ \texttt{\DTMtoday} เวลา \texttt{\DTMcurrenttime}
86 | (เวอร์ชัน \texttt{v1.1})
87 |
88 | \smallskip\noindent
89 | ติดต่อสอบถามหรือติดตามรายละเอียดเพิ่มเติมได้ที่\; \url{https://techjam.tech}
90 |
91 | \end{small}
92 |
--------------------------------------------------------------------------------
/01_quickfire.tex:
--------------------------------------------------------------------------------
1 | % !TEX root = main.tex
2 |
3 | \begin{quote}
4 | \em
5 | \vphantom{}\marginnote{%
6 | \textbf{หมายเหตุ}\; โจทย์บางข้อที่ปรากฏอาจมีลักษณะเป็นคำถามปรนัย (มีตัวเลือก)
7 | เนื่องจากเป็นข้อจำกัดของระบบในการแข่งขันระดับ Audition
8 | }%
9 | \llap{\adfdownleafleft\;}โจทย์ Quickfire เป็นโจทย์ประเภทถามเร็ว-ตอบเร็ว
10 | ผู้เข้าแข่งขันมีเวลา 10{\hrsp--\hrsp}60 วินาที ที่จะตอบคำถามให้ถูกต้อง
11 | โดยไม่สามารถใช้คอมพิวเตอร์เพื่อช่วยหาคำตอบได้
12 | \end{quote}
13 |
14 | \input{questions01_quickfire/central_audition_linearswap.tex}
15 | \input{questions01_quickfire/northeast_regional_fiboratio.tex}
16 | \input{questions01_quickfire/north_audition_buffaloeasy.tex}
17 |
18 | \newpage
19 | \input{questions01_quickfire/north_regional_buffalomedium.tex}
20 | \input{questions01_quickfire/south_regional_treeheight.tex}
21 | \input{questions01_quickfire/northeast_audition_betterthanlinear.tex}
22 | \input{questions01_quickfire/northeast_audition_counteven.tex}
23 | \input{questions01_quickfire/south_regional_clocktick.tex}
24 |
25 | \newpage
26 | \input{questions01_quickfire/northeast_audition_parenbalance.tex}
27 | \input{questions01_quickfire/north_audition_validbfs.tex}
28 | \input{questions01_quickfire/south_regional_negmaxsum.tex}
29 | \input{questions01_quickfire/north_audition_negmaxsum.tex}
30 |
31 | \newpage
32 | \input{questions01_quickfire/south_regional_reverseshuffle.tex}
33 | \input{questions01_quickfire/north_regional_lockboxes.tex}
34 | \input{questions01_quickfire/central_audition_treereducer.tex}
35 |
36 | \newpage
37 | \input{questions01_quickfire/central_audition_squaretiling.tex}
38 | \input{questions01_quickfire/north_regional_pigeoncard.tex}
39 | \input{questions01_quickfire/northeast_regional_whatm.tex}
40 |
41 | \newpage
42 | \input{questions01_quickfire/north_regional_recursiondepth.tex}
43 | \input{questions01_quickfire/central_regional_nestbox.tex}
44 |
45 | \newpage
46 | \input{questions01_quickfire/central_audition_sortbetweenintro.tex}
47 | \input{questions01_quickfire/central_regional_sortbetweensuper.tex}
48 | \input{questions01_quickfire/central_regional_closedshapearea.tex}
49 |
50 | \newpage
51 | \input{questions01_quickfire/central_regional_bfsdfs.tex}
52 | \input{questions01_quickfire/central_regional_cssiblings.tex}
53 |
54 |
--------------------------------------------------------------------------------
/02_ponder.tex:
--------------------------------------------------------------------------------
1 | % !TEX root = main.tex
2 |
3 | \begin{quote}
4 | \em
5 | \vphantom{}\marginnote{%
6 | \textbf{หมายเหตุ}\; โจทย์บางข้อที่ปรากฏอาจมีลักษณะเป็นคำถามปรนัย (มีตัวเลือก)
7 | เนื่องจากเป็นข้อจำกัดของระบบในการแข่งขันระดับ Audition
8 | }%
9 | \llap{\adfdownleafleft\;}สำหรับโจทย์ประเภท Ponder
10 | ผู้เข้าแข่งขันจะมีเวลาวิเคราะห์โจทย์และค้นหาคำตอบภายในเวลา 5 นาที\;
11 | สามารถใช้คอมพิวเตอร์เพื่อช่วยหาคำตอบได้อย่างเต็มที่
12 | \end{quote}
13 |
14 | \input{questions02_ponder/south_audition_countdigits.tex}
15 | \input{questions02_ponder/south_audition_dfsbst.tex}
16 | \input{questions02_ponder/south_regional_sumofdigits.tex}
17 | \input{questions02_ponder/south_regional_iq180p1.tex}
18 |
19 | \newpage
20 | \input{questions02_ponder/northeast_audition_sqroot.tex}
21 | \input{questions02_ponder/north_regional_trailingzeros.tex}
22 | \input{questions02_ponder/north_audition_randommod.tex}
23 |
24 | \newpage
25 | \input{questions02_ponder/central_regional_comptreeesay.tex}
26 | \input{questions02_ponder/south_regional_comptreehard.tex}
27 | \input{questions02_ponder/northeast_regional_maketriangle.tex}
28 |
29 | \newpage
30 | \input{questions02_ponder/northeast_audition_timecomplexeasy.tex}
31 | \input{questions02_ponder/central_audition_timecomplexhard.tex}
32 |
33 | \newpage
34 | \input{questions02_ponder/north_audition_twosidecoin.tex}
35 | \input{questions02_ponder/northeast_regional_licenseplate.tex}
36 | \input{questions02_ponder/north_regional_sumcell.tex}
37 | \input{questions02_ponder/north_regional_goodtimes.tex}
38 |
39 | \newpage
40 | \input{questions02_ponder/north_regional_subsetsum.tex}
41 | \input{questions02_ponder/central_audition_primepartition.tex}
42 | \input{questions02_ponder/national_contiguousprimes.tex}
43 | \input{questions02_ponder/central_audition_biasedcoin.tex}
44 |
45 | \newpage
46 | \input{questions02_ponder/central_audition_cloudupgrade.tex}
47 | \input{questions02_ponder/national_3tap.tex}
48 |
49 | \newpage
50 | \input{questions02_ponder/central_audition_infinitepath.tex}
51 | \input{questions02_ponder/central_regional_cryptarithmetic.tex}
52 |
53 | \newpage
54 | \input{questions02_ponder/central_regional_intbipartite.tex}
55 | \input{questions02_ponder/central_regional_candy.tex}
56 | \input{questions02_ponder/national_makechange.tex}
57 |
58 | \newpage
59 | \input{questions02_ponder/central_regional_pizzapaint.tex}
60 | \input{questions02_ponder/national_fourbyfour.tex}
61 | \input{questions02_ponder/national_validatearray.tex}
62 |
63 | \newpage
64 | \input{questions02_ponder/national_picturehang.tex}
65 | \input{questions02_ponder/national_vault.tex}
66 |
67 | \newpage
68 | \input{questions02_ponder/national_greedytsp.tex}
69 | \input{questions02_ponder/national_foodchain.tex}
70 |
71 | \newpage
72 | \input{questions02_ponder/national_tetris.tex}
73 | \input{questions02_ponder/national_classroom.tex}
74 |
--------------------------------------------------------------------------------
/03_coding.tex:
--------------------------------------------------------------------------------
1 | % !TEX root = main.tex
2 |
3 | \begin{quote}
4 | \em
5 | \vphantom{~}\llap{\adfdownleafleft\;}โจทย์ประเภท Coding
6 | เป็นโจทย์สไตล์ competitive programming ที่ผู้เข้าแข่งขันจะต้องทำความเข้าใจโจทย์ปัญหาเชิงคำนวณ
7 | แล้วเลือกโครงสร้างข้อมูลหรืออัลกอริทึมที่เหมาะสมมาแก้ปัญหาดังกล่าว\;
8 | ผู้เข้าแข่งขันจะต้องเขียนโปรแกรมด้วยภาษาที่ตนเองถนัดมารับ input
9 | ไปประมวลผล แล้วจึง output ผลลัพธ์ที่ประมวลผลได้\;
10 | \end{quote}
11 |
12 | %% Setup specific blocking for centering verbatim
13 | \newlength{\monochar}
14 | \settowidth{\monochar}{\texttt{a}}
15 | \newenvironment{centervrb}[1]{%
16 | \begin{minipage}[t]{#1\monochar}
17 | \setstretch{0.8}
18 | }{%
19 | \end{minipage}
20 | }
21 |
22 | \input{questions03_coding/south_regional_islandcounting.tex}
23 | \newpage
24 | \input{questions03_coding/south_regional_shippingdolls.tex}
25 | \newpage
26 | \input{questions03_coding/central_regional_descendingdrills.tex}
27 | \newpage
28 | \input{questions03_coding/central_regional_polymerchain.tex}
29 | \newpage
30 | \input{questions03_coding/central_regional_lobbyingtollway.tex}
31 | \newpage
32 | \input{questions03_coding/national_interceptmeteor.tex}
33 | \newpage
34 | \input{questions03_coding/national_findingpeepchan.tex}
35 | \newpage
36 | \input{questions03_coding/national_stablemolecule.tex}
37 | \newpage
38 | \input{questions03_coding/national_rotatesort.tex}
39 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # ข้อมูลการแก้ไขที่สำคัญ
2 |
3 | ## เอกสารเวอร์ชัน `v1.1`
4 |
5 | - **คำถามที่ 21.** แก้ไขตัวอย่างโจทย์จาก `sort_between(L_0, 2, 4)` เป็น `sort_between(L_0, 2, 5)`
6 | (ข้อผิดพลาดนี้ไม่ปรากฏในโจทย์ต้นฉบับ)
7 |
8 |
9 | ## เอกสารเวอร์ชัน `v1.0`
10 |
11 | - เผยแพร่เอกสารครั้งแรก
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TechJam 2018 CODE SQUAD Questions
2 |
3 | ชุดคำถามที่ใช้แข่งขัน TechJam2018 CODE SQUAD (by KBTG) ในรูปแบบของอีบุ๊ก PDF
4 |
5 |
6 | ## ดาวน์โหลด
7 |
8 | [สามารถดาวน์โหลด PDF เวอร์ชันล่าสุดได้ที่นี่](https://github.com/abhabongse/techjam2018-codesquad-questions/releases)
9 | **หมายเหตุ:** เอกสาร PDF ถูกจัดเรียงให้เหมาะสมกับการพิมพ์บนทั้งสองด้านของกระดาษ A4
10 |
11 |
12 | ## ข้อมูลการแก้ไขที่สำคัญ
13 |
14 | [ดูข้อมูลการแก้ไขที่สำคัญได้จากหน้านี้](CHANGELOG.md)
15 |
16 |
17 | ## ทรัพย์สินทางปัญญา
18 |
19 | เอกสารในรูปแบบของ PDF รวมถึงเนื้อหาภายในเอกสารกรรมสิทธิ์ของ กสิกร บิซิเนส-เทคโนโลยี กรุ๊ป
20 | และถูกเผยแพร่ภายใต้สัญญาอนุญาต [Creative Commons Attribution-NonCommercial 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/)
21 |
22 | ซอร์สโค้ด LaTeX ที่ใช้สร้างเอกสารฉบับนี้ถูกเผยแพร่ภายใต้สัญญาอนุญาต [The LaTeX Project Public License Version 1.3c](LICENSE)
23 |
24 |
25 | ## สนับสนุนพัฒนา
26 |
27 | คุณสามารถร่วมสนันสนุนพัฒนาเอกสารฉบับนี้ได้ผ่าน Pull Request
28 |
29 | หากคุณอยากเขียนเนื้อหาเสริม โปรดติดต่อผ่านหน้า Issues เพื่อพูดคุยกัน
30 |
31 |
32 | ## ฟอนต์ในเอกสาร
33 |
34 | - [Sarabun by Cadson Demak](https://github.com/cadsondemak/Sarabun) ภายใต้สัญญาอนุญาต SIL Open Font License
35 | - [Kanit by Cadson Demak](https://github.com/cadsondemak/Kanit) ภายใต้สัญญาอนุญาต SIL Open Font License
36 | - [Fira Mono by Mozilla](https://github.com/mozilla/Fira) ภายใต้สัญญาอนุญาต SIL Open Font License
37 | - [Fira Code by Nikita Prokopov](https://github.com/tonsky/FiraCode) ภายใต้สัญญาอนุญาต SIL Open Font License
38 | - [FiraGO by bBoxType](https://github.com/bBoxType/FiraGO) ภายใต้สัญญาอนุญาต SIL Open Font License
39 |
--------------------------------------------------------------------------------
/assets/code-squad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/assets/code-squad.png
--------------------------------------------------------------------------------
/assets/techjam-2018.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/assets/techjam-2018.png
--------------------------------------------------------------------------------
/figures/coding_national_findingpeepchan_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/figures/coding_national_findingpeepchan_01.png
--------------------------------------------------------------------------------
/figures/coding_national_findingpeepchan_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/figures/coding_national_findingpeepchan_02.png
--------------------------------------------------------------------------------
/figures/coding_national_interceptmeteor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/figures/coding_national_interceptmeteor.png
--------------------------------------------------------------------------------
/figures/coding_national_stablemolecule_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/figures/coding_national_stablemolecule_01.png
--------------------------------------------------------------------------------
/figures/coding_national_stablemolecule_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/figures/coding_national_stablemolecule_02.png
--------------------------------------------------------------------------------
/figures/coding_national_stablemolecule_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/figures/coding_national_stablemolecule_03.png
--------------------------------------------------------------------------------
/figures/font-selection.isy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | \makeatletter
6 | \usepackage{etoolbox}
7 |
8 | \usepackage[T1]{fontenc}
9 | \usepackage{noto}
10 | \usepackage{lato}
11 | \usepackage{inconsolata}
12 | \usepackage{fouriernc}
13 |
14 | \def\familydefault{\sfdefault}
15 | \def\rmdefault{NotoSerif-TOsF}
16 | \def\sfdefault{lato-TOsF}
17 | \def\ttdefault{zi4}
18 | \def\zifour@scaled{s*[0.925]}
19 | \def\zifour@narrow{}
20 | \def\zifour@opt{0}
21 | \def\zifour@altopt{2}
22 | \def\zifour@spc{\hyphenchar\font=\m@ne}
23 |
24 | \usepackage{mweights}
25 | \def\mdseries@rm{l}
26 | \def\bfseries@rm{eb}
27 | \def\mdseries@sf{l}
28 | \def\bfseries@sf{eb}
29 |
30 | \newrobustcmd\selectweight[1]{\fontseries{#1}\selectfont}
31 |
32 | \usepackage{setspace}
33 | \setstretch{1.2}
34 |
35 | % Setup math fonts and symbols
36 | \usepackage{fdsymbol}
37 | \usepackage{fontawesome}
38 | \usepackage[%
39 | activate={true,nocompatibility},final,tracking=true,letterspace=40,%
40 | kerning=true,spacing=true,factor=1150,stretch=15,shrink=15%
41 | ]{microtype}
42 | \microtypecontext{spacing=nonfrench}
43 |
44 | \makeatother
45 |
46 |
47 |
--------------------------------------------------------------------------------
/figures/kbtg-colors.isy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/figures/ponder_national_fourbyfour.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 00:52:36 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 65 65
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %!FontType1-1.1 f-0-0 1.0
67 | 11 dict begin
68 | /FontName /f-0-0 def
69 | /PaintType 0 def
70 | /FontType 1 def
71 | /FontMatrix [0.001 0 0 0.001 0 0] readonly def
72 | /FontBBox {23 -7 489 715 } readonly def
73 | /Encoding 256 array
74 | 0 1 255 {1 index exch /.notdef put} for
75 | dup 1 /uni003F put
76 | readonly def
77 | currentdict end
78 | currentfile eexec
79 | f983ef0097ece636fb4a96c74d26ab84185f6dfa4a16a7a1c27bbe3f1156aea698df336d20b467
80 | b10e7f33846656653c5ac6962759d3056cbdb3190bac614b984bf5a132dc418192443014ba63de
81 | 800a9c2cbaae3e98d910ec768e3ec0a68d6662ed0a4786decd0bc494681b7a8f496910cd7b4630
82 | 6dc8ae9298e870deef7a0ea25578226e409aa0b4147f7b82b7598ad503870b1045c168eb0c100e
83 | 42b0f810d306f8f7f38011c973c0fb43b3d4511ebd07847dd8587bb33de670b6b0b94ed7772fe2
84 | 92f5b1bfe83ad2c9d4f17ed4f34a3ab5b1c268ae43a5947d16525f9ffef6d057d70f07acc67574
85 | 27d7d3f6aa307d2bc8f59c82b8579918945de0cbfe985b93304f9c1606cea3d4755ffe9ec168f3
86 | 9e6b78d92e192b1308a9043908fed56cd1e7369c37b87613417b85518905ff3cc67e4c58d19800
87 | 35d5e73405a161498553d6a48f100a45d3d4527a374565235f45e7a91e1acc9af2328d2fcdd785
88 | 1efaad9112b81a9379ae48b7d5b83b8fab75858f2ca2c09f77cb6265abdd9804486791bb72a177
89 | f6dcae050984e00e3c6731ab9d5170f756a130faaa05a8259defbf94910c53451724652309769b
90 | 62187e55af753c769f7363d56394c457ff31cf5fdfc75fabfc96a88de1017e123bed312413342f
91 | ddc3d1d09bef176942be976d4f64d9dfc586fb6ffe9bb2d3904a1b955279abf2504785484e201d
92 | 948fae800587dab0323d37bf936fb5c79e2f8a12a54096d0d49c41ec0355341d73a9ce0f73dd42
93 | 59f630c74c96eb9eb5d7adad9faea002fe88c8653ce1ce4981be35369c5c7490a6e0efdbd8e8f1
94 | ec36212dfc5d2a06e4f96003c25322cc54782374744a07ed6a76f02e62932930414ee25c6b3b7b
95 | e9df1e522bacf46d3f68da7cb0621954759cbc3d48719e9e1ffb3b59b384b2e592b0ae07d934fd
96 | 73a1a4c32717bcd2867df571be51a011d9ff892107063bbea567bef1635600d9a5163468523a71
97 | 470596904ef675d39910461c3499b1255dda044c995954bc535888131fdfe552908de5daaa1fbd
98 | 0cb53938f28207d0e5c2f71fa312ae4665f73eaad89322cc2285e4931a35f717c04ccfd926328c
99 | 627616443324b8866b6cc74ed0edbd1670a3d364a9e829cb317e71de54a14a22d5c3351145447c
100 | 350d05b9a15fdc78229f1e8868e43a7c1cdc4030f3ac6908821e71e56cc123045442d2b5b2b223
101 | 8594c775c0ec7b42ec5c09a66f60307b8026a75c31ceb2788a5ac5b1fdc7b6044f001df21c73c4
102 | 295025d841f57a858fd0e7c4478ebabfd0a09eb9bb8c30f8ff10086c87b5447036da4ead7b2c24
103 | 6971c3d285d9a581740561a57f959562265d0eb0dd33b1f3b9eeb47d466f8185142bfb7f65e000
104 | a2ea7cba07190618f8c8590e03afa315b2f63a3271016a743f661862d72739a20d878ec4cfd6bb
105 | 032d9d743bff44430a78cf1487f8cea90bc4fa26a9bf7a13b6bc9c4190a65563808053dd0d9715
106 | ae0d2fa6be292d7c280930a9747c7768a6dd2b8c57d7c02dd8e6ddd0ad644ea25b979c4839dab3
107 | 6cc1750000000000000000000000000000000000000000000000000000000000000000
108 | 0000000000000000000000000000000000000000000000000000000000000000
109 | 0000000000000000000000000000000000000000000000000000000000000000
110 | 0000000000000000000000000000000000000000000000000000000000000000
111 | 0000000000000000000000000000000000000000000000000000000000000000
112 | 0000000000000000000000000000000000000000000000000000000000000000
113 | 0000000000000000000000000000000000000000000000000000000000000000
114 | 0000000000000000000000000000000000000000000000000000000000000000
115 | cleartomark
116 | %%Page: 1 1
117 | %%BeginPageSetup
118 | %%PageBoundingBox: 0 0 65 65
119 | %%EndPageSetup
120 | q
121 | 0 g
122 | 0.4 w
123 | 0 J
124 | 1 j
125 | [] 0.0 d
126 | 10 M 0.199 48.801 m 64.199 48.801 l S
127 | 0.199 32.801 m 64.199 32.801 l S
128 | 0.199 16.801 m 64.199 16.801 l S
129 | 48.199 0.801 m 48.199 64.801 l S
130 | 32.199 64.801 m 32.199 0.801 l S
131 | 16.199 0.801 m 16.199 64.801 l S
132 | BT
133 | 9.9626 0 0 9.9626 6.048 53.2325 Tm
134 | /f-0-0 1 Tf
135 | [<01>-1174<01>-1174<01>-1174<01>]TJ
136 | 0 -1.606006 Td
137 | [<01>-1174<01>-1174<01>-1174<01>]TJ
138 | 0 -1.606006 Td
139 | [<01>-1174<01>-1174<01>-1174<01>]TJ
140 | 0 -1.606006 Td
141 | [<01>-1174<01>-1174<01>-1174<01>]TJ
142 | ET
143 | Q
144 | showpage
145 | %%Trailer
146 | count op_count sub {pop} repeat
147 | countdictstack dict_count sub {end} repeat
148 | cairo_eps_state restore
149 | %%EOF
150 |
--------------------------------------------------------------------------------
/figures/ponder_national_greedytsp_01.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 13:04:06 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 109 77
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 109 77
69 | %%EndPageSetup
70 | q
71 | 0.78 g
72 | 12.016 70.645 m 12.016 73.766 9.48 76.301 6.355 76.301 c 3.234 76.301
73 | 0.699 73.766 0.699 70.645 c 0.699 67.52 3.234 64.984 6.355 64.984 c
74 | 9.48 64.984 12.016 67.52 12.016 70.645 c h
75 | 12.016 70.645 m f*
76 | 44.016 70.645 m 44.016 73.766 41.48 76.301 38.355 76.301 c 35.234
77 | 76.301 32.699 73.766 32.699 70.645 c 32.699 67.52 35.234 64.984 38.355
78 | 64.984 c 41.48 64.984 44.016 67.52 44.016 70.645 c h
79 | 44.016 70.645 m f*
80 | 76.016 70.645 m 76.016 73.766 73.48 76.301 70.355 76.301 c 67.234
81 | 76.301 64.699 73.766 64.699 70.645 c 64.699 67.52 67.234 64.984 70.355
82 | 64.984 c 73.48 64.984 76.016 67.52 76.016 70.645 c h
83 | 76.016 70.645 m f*
84 | 108.016 70.645 m 108.016 73.766 105.48 76.301 102.355 76.301 c 99.234
85 | 76.301 96.699 73.766 96.699 70.645 c 96.699 67.52 99.234 64.984 102.355
86 | 64.984 c 105.48 64.984 108.016 67.52 108.016 70.645 c h
87 | 108.016 70.645 m f*
88 | 12.016 38.645 m 12.016 41.766 9.48 44.301 6.355 44.301 c 3.234 44.301
89 | 0.699 41.766 0.699 38.645 c 0.699 35.52 3.234 32.984 6.355 32.984 c
90 | 9.48 32.984 12.016 35.52 12.016 38.645 c h
91 | 12.016 38.645 m f*
92 | 12.016 6.645 m 12.016 9.766 9.48 12.301 6.355 12.301 c 3.234 12.301
93 | 0.699 9.766 0.699 6.645 c 0.699 3.52 3.234 0.984 6.355 0.984 c 9.48
94 | 0.984 12.016 3.52 12.016 6.645 c h
95 | 12.016 6.645 m f*
96 | 44.016 38.645 m 44.016 41.766 41.48 44.301 38.355 44.301 c 35.234
97 | 44.301 32.699 41.766 32.699 38.645 c 32.699 35.52 35.234 32.984 38.355
98 | 32.984 c 41.48 32.984 44.016 35.52 44.016 38.645 c h
99 | 44.016 38.645 m f*
100 | 76.016 38.645 m 76.016 41.766 73.48 44.301 70.355 44.301 c 67.234
101 | 44.301 64.699 41.766 64.699 38.645 c 64.699 35.52 67.234 32.984 70.355
102 | 32.984 c 73.48 32.984 76.016 35.52 76.016 38.645 c h
103 | 76.016 38.645 m f*
104 | 108.016 38.645 m 108.016 41.766 105.48 44.301 102.355 44.301 c 99.234
105 | 44.301 96.699 41.766 96.699 38.645 c 96.699 35.52 99.234 32.984 102.355
106 | 32.984 c 105.48 32.984 108.016 35.52 108.016 38.645 c h
107 | 108.016 38.645 m f*
108 | 44.016 6.645 m 44.016 9.766 41.48 12.301 38.355 12.301 c 35.234 12.301
109 | 32.699 9.766 32.699 6.645 c 32.699 3.52 35.234 0.984 38.355 0.984 c
110 | 41.48 0.984 44.016 3.52 44.016 6.645 c h
111 | 44.016 6.645 m f*
112 | 76.016 6.645 m 76.016 9.766 73.48 12.301 70.355 12.301 c 67.234 12.301
113 | 64.699 9.766 64.699 6.645 c 64.699 3.52 67.234 0.984 70.355 0.984 c
114 | 73.48 0.984 76.016 3.52 76.016 6.645 c h
115 | 76.016 6.645 m f*
116 | 108.016 6.645 m 108.016 9.766 105.48 12.301 102.355 12.301 c 99.234
117 | 12.301 96.699 9.766 96.699 6.645 c 96.699 3.52 99.234 0.984 102.355
118 | 0.984 c 105.48 0.984 108.016 3.52 108.016 6.645 c h
119 | 108.016 6.645 m f*
120 | Q
121 | showpage
122 | %%Trailer
123 | count op_count sub {pop} repeat
124 | countdictstack dict_count sub {end} repeat
125 | cairo_eps_state restore
126 | %%EOF
127 |
--------------------------------------------------------------------------------
/figures/ponder_national_greedytsp_02.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 13:04:18 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 109 77
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 109 77
69 | %%EndPageSetup
70 | q
71 | 0.78 g
72 | 12.016 70.645 m 12.016 73.766 9.48 76.301 6.355 76.301 c 3.234 76.301
73 | 0.699 73.766 0.699 70.645 c 0.699 67.52 3.234 64.984 6.355 64.984 c
74 | 9.48 64.984 12.016 67.52 12.016 70.645 c h
75 | 12.016 70.645 m f*
76 | 44.016 70.645 m 44.016 73.766 41.48 76.301 38.355 76.301 c 35.234
77 | 76.301 32.699 73.766 32.699 70.645 c 32.699 67.52 35.234 64.984 38.355
78 | 64.984 c 41.48 64.984 44.016 67.52 44.016 70.645 c h
79 | 44.016 70.645 m f*
80 | 76.016 70.645 m 76.016 73.766 73.48 76.301 70.355 76.301 c 67.234
81 | 76.301 64.699 73.766 64.699 70.645 c 64.699 67.52 67.234 64.984 70.355
82 | 64.984 c 73.48 64.984 76.016 67.52 76.016 70.645 c h
83 | 76.016 70.645 m f*
84 | 108.016 70.645 m 108.016 73.766 105.48 76.301 102.355 76.301 c 99.234
85 | 76.301 96.699 73.766 96.699 70.645 c 96.699 67.52 99.234 64.984 102.355
86 | 64.984 c 105.48 64.984 108.016 67.52 108.016 70.645 c h
87 | 108.016 70.645 m f*
88 | 12.016 38.645 m 12.016 41.766 9.48 44.301 6.355 44.301 c 3.234 44.301
89 | 0.699 41.766 0.699 38.645 c 0.699 35.52 3.234 32.984 6.355 32.984 c
90 | 9.48 32.984 12.016 35.52 12.016 38.645 c h
91 | 12.016 38.645 m f*
92 | 12.016 6.645 m 12.016 9.766 9.48 12.301 6.355 12.301 c 3.234 12.301
93 | 0.699 9.766 0.699 6.645 c 0.699 3.52 3.234 0.984 6.355 0.984 c 9.48
94 | 0.984 12.016 3.52 12.016 6.645 c h
95 | 12.016 6.645 m f*
96 | 44.016 38.645 m 44.016 41.766 41.48 44.301 38.355 44.301 c 35.234
97 | 44.301 32.699 41.766 32.699 38.645 c 32.699 35.52 35.234 32.984 38.355
98 | 32.984 c 41.48 32.984 44.016 35.52 44.016 38.645 c h
99 | 44.016 38.645 m f*
100 | 76.016 38.645 m 76.016 41.766 73.48 44.301 70.355 44.301 c 67.234
101 | 44.301 64.699 41.766 64.699 38.645 c 64.699 35.52 67.234 32.984 70.355
102 | 32.984 c 73.48 32.984 76.016 35.52 76.016 38.645 c h
103 | 76.016 38.645 m f*
104 | 108.016 38.645 m 108.016 41.766 105.48 44.301 102.355 44.301 c 99.234
105 | 44.301 96.699 41.766 96.699 38.645 c 96.699 35.52 99.234 32.984 102.355
106 | 32.984 c 105.48 32.984 108.016 35.52 108.016 38.645 c h
107 | 108.016 38.645 m f*
108 | 44.016 6.645 m 44.016 9.766 41.48 12.301 38.355 12.301 c 35.234 12.301
109 | 32.699 9.766 32.699 6.645 c 32.699 3.52 35.234 0.984 38.355 0.984 c
110 | 41.48 0.984 44.016 3.52 44.016 6.645 c h
111 | 44.016 6.645 m f*
112 | 76.016 6.645 m 76.016 9.766 73.48 12.301 70.355 12.301 c 67.234 12.301
113 | 64.699 9.766 64.699 6.645 c 64.699 3.52 67.234 0.984 70.355 0.984 c
114 | 73.48 0.984 76.016 3.52 76.016 6.645 c h
115 | 76.016 6.645 m f*
116 | 108.016 6.645 m 108.016 9.766 105.48 12.301 102.355 12.301 c 99.234
117 | 12.301 96.699 9.766 96.699 6.645 c 96.699 3.52 99.234 0.984 102.355
118 | 0.984 c 105.48 0.984 108.016 3.52 108.016 6.645 c h
119 | 108.016 6.645 m f*
120 | 0.921 0.117 0.207 rg
121 | 2 w
122 | 1 J
123 | 1 j
124 | [] 0.0 d
125 | 10 M 6.355 66.645 m 6.355 6.645 l 38.355 6.645 l 38.355 38.645 l 70.355
126 | 38.645 l 70.355 6.645 l 102.355 6.645 l 102.355 70.645 l 6.355 70.645 l S
127 | 6.355 70.645 m 13.355 68.312 l 13.355 72.973 l h
128 | 6.355 70.645 m f*
129 | 6.355 70.645 m 13.355 68.312 l 13.355 72.973 l h
130 | 6.355 70.645 m S
131 | Q
132 | showpage
133 | %%Trailer
134 | count op_count sub {pop} repeat
135 | countdictstack dict_count sub {end} repeat
136 | cairo_eps_state restore
137 | %%EOF
138 |
--------------------------------------------------------------------------------
/figures/ponder_national_greedytsp_03.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 13:04:28 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 109 77
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 109 77
69 | %%EndPageSetup
70 | q
71 | 0.78 g
72 | 12.016 70.645 m 12.016 73.766 9.48 76.301 6.355 76.301 c 3.234 76.301
73 | 0.699 73.766 0.699 70.645 c 0.699 67.52 3.234 64.984 6.355 64.984 c
74 | 9.48 64.984 12.016 67.52 12.016 70.645 c h
75 | 12.016 70.645 m f*
76 | 44.016 70.645 m 44.016 73.766 41.48 76.301 38.355 76.301 c 35.234
77 | 76.301 32.699 73.766 32.699 70.645 c 32.699 67.52 35.234 64.984 38.355
78 | 64.984 c 41.48 64.984 44.016 67.52 44.016 70.645 c h
79 | 44.016 70.645 m f*
80 | 76.016 70.645 m 76.016 73.766 73.48 76.301 70.355 76.301 c 67.234
81 | 76.301 64.699 73.766 64.699 70.645 c 64.699 67.52 67.234 64.984 70.355
82 | 64.984 c 73.48 64.984 76.016 67.52 76.016 70.645 c h
83 | 76.016 70.645 m f*
84 | 108.016 70.645 m 108.016 73.766 105.48 76.301 102.355 76.301 c 99.234
85 | 76.301 96.699 73.766 96.699 70.645 c 96.699 67.52 99.234 64.984 102.355
86 | 64.984 c 105.48 64.984 108.016 67.52 108.016 70.645 c h
87 | 108.016 70.645 m f*
88 | 12.016 38.645 m 12.016 41.766 9.48 44.301 6.355 44.301 c 3.234 44.301
89 | 0.699 41.766 0.699 38.645 c 0.699 35.52 3.234 32.984 6.355 32.984 c
90 | 9.48 32.984 12.016 35.52 12.016 38.645 c h
91 | 12.016 38.645 m f*
92 | 12.016 6.645 m 12.016 9.766 9.48 12.301 6.355 12.301 c 3.234 12.301
93 | 0.699 9.766 0.699 6.645 c 0.699 3.52 3.234 0.984 6.355 0.984 c 9.48
94 | 0.984 12.016 3.52 12.016 6.645 c h
95 | 12.016 6.645 m f*
96 | 44.016 38.645 m 44.016 41.766 41.48 44.301 38.355 44.301 c 35.234
97 | 44.301 32.699 41.766 32.699 38.645 c 32.699 35.52 35.234 32.984 38.355
98 | 32.984 c 41.48 32.984 44.016 35.52 44.016 38.645 c h
99 | 44.016 38.645 m f*
100 | 76.016 38.645 m 76.016 41.766 73.48 44.301 70.355 44.301 c 67.234
101 | 44.301 64.699 41.766 64.699 38.645 c 64.699 35.52 67.234 32.984 70.355
102 | 32.984 c 73.48 32.984 76.016 35.52 76.016 38.645 c h
103 | 76.016 38.645 m f*
104 | 108.016 38.645 m 108.016 41.766 105.48 44.301 102.355 44.301 c 99.234
105 | 44.301 96.699 41.766 96.699 38.645 c 96.699 35.52 99.234 32.984 102.355
106 | 32.984 c 105.48 32.984 108.016 35.52 108.016 38.645 c h
107 | 108.016 38.645 m f*
108 | 44.016 6.645 m 44.016 9.766 41.48 12.301 38.355 12.301 c 35.234 12.301
109 | 32.699 9.766 32.699 6.645 c 32.699 3.52 35.234 0.984 38.355 0.984 c
110 | 41.48 0.984 44.016 3.52 44.016 6.645 c h
111 | 44.016 6.645 m f*
112 | 76.016 6.645 m 76.016 9.766 73.48 12.301 70.355 12.301 c 67.234 12.301
113 | 64.699 9.766 64.699 6.645 c 64.699 3.52 67.234 0.984 70.355 0.984 c
114 | 73.48 0.984 76.016 3.52 76.016 6.645 c h
115 | 76.016 6.645 m f*
116 | 108.016 6.645 m 108.016 9.766 105.48 12.301 102.355 12.301 c 99.234
117 | 12.301 96.699 9.766 96.699 6.645 c 96.699 3.52 99.234 0.984 102.355
118 | 0.984 c 105.48 0.984 108.016 3.52 108.016 6.645 c h
119 | 108.016 6.645 m f*
120 | 0.921 0.117 0.207 rg
121 | 2 w
122 | 1 J
123 | 1 j
124 | [] 0.0 d
125 | 10 M 38.355 10.645 m 38.355 66.645 l 70.355 66.645 l 70.355 6.645 l 102.355
126 | 6.645 l 102.355 70.645 l 6.355 70.645 l 6.355 6.645 l 38.355 6.645 l S
127 | 38.355 6.645 m 31.355 8.973 l 31.355 4.312 l h
128 | 38.355 6.645 m f*
129 | 38.355 6.645 m 31.355 8.973 l 31.355 4.312 l h
130 | 38.355 6.645 m S
131 | Q
132 | showpage
133 | %%Trailer
134 | count op_count sub {pop} repeat
135 | countdictstack dict_count sub {end} repeat
136 | cairo_eps_state restore
137 | %%EOF
138 |
--------------------------------------------------------------------------------
/figures/ponder_national_greedytsp_04.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 13:04:42 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 109 77
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 109 77
69 | %%EndPageSetup
70 | q
71 | 0.78 g
72 | 12.016 70.645 m 12.016 73.766 9.48 76.301 6.355 76.301 c 3.234 76.301
73 | 0.699 73.766 0.699 70.645 c 0.699 67.52 3.234 64.984 6.355 64.984 c
74 | 9.48 64.984 12.016 67.52 12.016 70.645 c h
75 | 12.016 70.645 m f*
76 | 44.016 70.645 m 44.016 73.766 41.48 76.301 38.355 76.301 c 35.234
77 | 76.301 32.699 73.766 32.699 70.645 c 32.699 67.52 35.234 64.984 38.355
78 | 64.984 c 41.48 64.984 44.016 67.52 44.016 70.645 c h
79 | 44.016 70.645 m f*
80 | 76.016 70.645 m 76.016 73.766 73.48 76.301 70.355 76.301 c 67.234
81 | 76.301 64.699 73.766 64.699 70.645 c 64.699 67.52 67.234 64.984 70.355
82 | 64.984 c 73.48 64.984 76.016 67.52 76.016 70.645 c h
83 | 76.016 70.645 m f*
84 | 108.016 70.645 m 108.016 73.766 105.48 76.301 102.355 76.301 c 99.234
85 | 76.301 96.699 73.766 96.699 70.645 c 96.699 67.52 99.234 64.984 102.355
86 | 64.984 c 105.48 64.984 108.016 67.52 108.016 70.645 c h
87 | 108.016 70.645 m f*
88 | 12.016 38.645 m 12.016 41.766 9.48 44.301 6.355 44.301 c 3.234 44.301
89 | 0.699 41.766 0.699 38.645 c 0.699 35.52 3.234 32.984 6.355 32.984 c
90 | 9.48 32.984 12.016 35.52 12.016 38.645 c h
91 | 12.016 38.645 m f*
92 | 12.016 6.645 m 12.016 9.766 9.48 12.301 6.355 12.301 c 3.234 12.301
93 | 0.699 9.766 0.699 6.645 c 0.699 3.52 3.234 0.984 6.355 0.984 c 9.48
94 | 0.984 12.016 3.52 12.016 6.645 c h
95 | 12.016 6.645 m f*
96 | 44.016 38.645 m 44.016 41.766 41.48 44.301 38.355 44.301 c 35.234
97 | 44.301 32.699 41.766 32.699 38.645 c 32.699 35.52 35.234 32.984 38.355
98 | 32.984 c 41.48 32.984 44.016 35.52 44.016 38.645 c h
99 | 44.016 38.645 m f*
100 | 76.016 38.645 m 76.016 41.766 73.48 44.301 70.355 44.301 c 67.234
101 | 44.301 64.699 41.766 64.699 38.645 c 64.699 35.52 67.234 32.984 70.355
102 | 32.984 c 73.48 32.984 76.016 35.52 76.016 38.645 c h
103 | 76.016 38.645 m f*
104 | 108.016 38.645 m 108.016 41.766 105.48 44.301 102.355 44.301 c 99.234
105 | 44.301 96.699 41.766 96.699 38.645 c 96.699 35.52 99.234 32.984 102.355
106 | 32.984 c 105.48 32.984 108.016 35.52 108.016 38.645 c h
107 | 108.016 38.645 m f*
108 | 44.016 6.645 m 44.016 9.766 41.48 12.301 38.355 12.301 c 35.234 12.301
109 | 32.699 9.766 32.699 6.645 c 32.699 3.52 35.234 0.984 38.355 0.984 c
110 | 41.48 0.984 44.016 3.52 44.016 6.645 c h
111 | 44.016 6.645 m f*
112 | 76.016 6.645 m 76.016 9.766 73.48 12.301 70.355 12.301 c 67.234 12.301
113 | 64.699 9.766 64.699 6.645 c 64.699 3.52 67.234 0.984 70.355 0.984 c
114 | 73.48 0.984 76.016 3.52 76.016 6.645 c h
115 | 76.016 6.645 m f*
116 | 108.016 6.645 m 108.016 9.766 105.48 12.301 102.355 12.301 c 99.234
117 | 12.301 96.699 9.766 96.699 6.645 c 96.699 3.52 99.234 0.984 102.355
118 | 0.984 c 105.48 0.984 108.016 3.52 108.016 6.645 c h
119 | 108.016 6.645 m f*
120 | 0.921 0.117 0.207 rg
121 | 2 w
122 | 1 J
123 | 1 j
124 | [] 0.0 d
125 | 10 M 14.355 6.645 m 102.355 6.645 l 102.355 70.645 l 6.355 70.645 l 6.355
126 | 38.645 l 70.355 38.645 l 6.355 6.645 l S
127 | 6.355 6.645 m 13.66 7.688 l 11.574 11.859 l h
128 | 6.355 6.645 m f*
129 | 6.355 6.645 m 13.66 7.688 l 11.574 11.859 l h
130 | 6.355 6.645 m S
131 | Q
132 | showpage
133 | %%Trailer
134 | count op_count sub {pop} repeat
135 | countdictstack dict_count sub {end} repeat
136 | cairo_eps_state restore
137 | %%EOF
138 |
--------------------------------------------------------------------------------
/figures/ponder_national_picturehang_01.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 02:28:27 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 1 136 193
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 1 136 193
69 | %%EndPageSetup
70 | q
71 | 0 g
72 | 1.2 w
73 | 1 J
74 | 1 j
75 | [] 0.0 d
76 | 10 M 19.766 97.234 m -12.234 129.234 3.766 145.234 14.434 158.566 c 25.102
77 | 171.898 30.434 182.566 43.766 187.898 c 57.102 193.234 78.434 193.234
78 | 91.766 187.898 c 105.102 182.566 110.434 171.898 121.102 158.566 c
79 | 131.766 145.234 147.766 129.234 115.766 97.234 c S
80 | 0.596 0.78 0.964 rg
81 | 22.965 126.188 m 26.168 129.234 32.566 129.234 45.367 129.234 c 58.168
82 | 129.234 77.367 129.234 90.168 129.234 c 102.965 129.234 109.367 129.234
83 | 112.566 126.188 c 115.766 123.137 115.766 117.043 115.766 98.758 c
84 | 115.766 80.473 115.766 49.996 115.766 31.711 c 115.766 13.422 115.766
85 | 7.328 112.566 4.281 c 109.367 1.234 102.965 1.234 90.168 1.234 c 77.367
86 | 1.234 58.168 1.234 45.367 1.234 c 32.566 1.234 26.168 1.234 22.965
87 | 4.281 c 19.766 7.328 19.766 13.422 19.766 31.711 c 19.766 49.996 19.766
88 | 80.473 19.766 98.758 c 19.766 117.043 19.766 123.137 22.965 126.188 c h
89 | 22.965 126.188 m f*
90 | 1 g
91 | 106.168 65.234 m 106.168 95.531 88.973 120.09 67.766 120.09 c 46.559
92 | 120.09 29.367 95.531 29.367 65.234 c 29.367 34.938 46.559 10.375 67.766
93 | 10.375 c 88.973 10.375 106.168 34.938 106.168 65.234 c h
94 | 106.168 65.234 m f*
95 | 0.305 0.305 0.301 rg
96 | 47.766 169.234 m 47.766 174.566 39.766 174.566 39.766 169.234 c 39.766
97 | 163.898 47.766 163.898 47.766 169.234 c h
98 | 47.766 169.234 m f*
99 | 95.766 169.234 m 95.766 174.566 87.766 174.566 87.766 169.234 c 87.766
100 | 163.898 95.766 163.898 95.766 169.234 c h
101 | 95.766 169.234 m f*
102 | Q
103 | showpage
104 | %%Trailer
105 | count op_count sub {pop} repeat
106 | countdictstack dict_count sub {end} repeat
107 | cairo_eps_state restore
108 | %%EOF
109 |
--------------------------------------------------------------------------------
/figures/ponder_national_picturehang_02.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 02:28:36 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 130 207
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 130 207
69 | %%EndPageSetup
70 | q
71 | 0 g
72 | 1.2 w
73 | 1 J
74 | 1 j
75 | [] 0.0 d
76 | 10 M 16.922 96.906 m -15.078 128.906 8.922 168.906 23.586 188.906 c 38.254
77 | 208.906 43.586 208.906 48.922 200.906 c 54.254 192.906 59.586 176.906
78 | 67.586 166.242 c 75.586 155.574 86.254 150.242 94.254 150.242 c 102.254
79 | 150.242 107.586 155.574 110.254 160.906 c 112.922 166.242 112.922
80 | 171.574 110.254 176.906 c 107.586 182.242 102.254 187.574 96.922
81 | 190.242 c 91.586 192.906 86.254 192.906 78.254 192.906 c 70.254 192.906
82 | 59.586 192.906 51.586 192.906 c 43.586 192.906 38.254 192.906 32.922
83 | 190.242 c 27.586 187.574 22.254 182.242 19.586 176.906 c 16.922 171.574
84 | 16.922 166.242 19.586 160.906 c 22.254 155.574 27.586 150.242 35.586
85 | 150.242 c 43.586 150.242 54.254 155.574 62.254 166.242 c 70.254 176.906
86 | 75.586 192.906 80.922 200.906 c 86.254 208.906 91.586 208.906 106.254
87 | 188.906 c 120.922 168.906 144.922 128.906 112.922 96.906 c S
88 | 0.596 0.964 0.756 rg
89 | 20.121 125.859 m 23.32 128.906 29.719 128.906 42.52 128.906 c 55.32
90 | 128.906 74.52 128.906 87.32 128.906 c 100.121 128.906 106.52 128.906
91 | 109.719 125.859 c 112.922 122.812 112.922 116.719 112.922 98.43 c
92 | 112.922 80.145 112.922 49.668 112.922 31.383 c 112.922 13.098 112.922
93 | 7.004 109.719 3.957 c 106.52 0.906 100.121 0.906 87.32 0.906 c 74.52
94 | 0.906 55.32 0.906 42.52 0.906 c 29.719 0.906 23.32 0.906 20.121 3.957 c
95 | 16.922 7.004 16.922 13.098 16.922 31.383 c 16.922 49.668 16.922 80.145
96 | 16.922 98.43 c 16.922 116.719 16.922 122.812 20.121 125.859 c h
97 | 20.121 125.859 m f*
98 | 1 g
99 | 103.32 64.91 m 103.32 95.207 86.129 119.766 64.922 119.766 c 43.711
100 | 119.766 26.52 95.207 26.52 64.91 c 26.52 34.613 43.711 10.051 64.922
101 | 10.051 c 86.129 10.051 103.32 34.613 103.32 64.91 c h
102 | 103.32 64.91 m f*
103 | 0.305 0.305 0.301 rg
104 | 44.922 168.906 m 44.922 174.242 36.922 174.242 36.922 168.906 c 36.922
105 | 163.574 44.922 163.574 44.922 168.906 c h
106 | 44.922 168.906 m f*
107 | 92.922 168.906 m 92.922 174.242 84.922 174.242 84.922 168.906 c 84.922
108 | 163.574 92.922 163.574 92.922 168.906 c h
109 | 92.922 168.906 m f*
110 | Q
111 | showpage
112 | %%Trailer
113 | count op_count sub {pop} repeat
114 | countdictstack dict_count sub {end} repeat
115 | cairo_eps_state restore
116 | %%EOF
117 |
--------------------------------------------------------------------------------
/figures/ponder_national_picturehang_03.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 02:28:43 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 124 220
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 124 220
69 | %%EndPageSetup
70 | q
71 | 0 g
72 | 1.2 w
73 | 1 J
74 | 1 j
75 | [] 0.0 d
76 | 10 M 23.789 96.996 m -1.812 133.566 -1.812 170.137 4.586 191.473 c 10.988
77 | 212.805 23.789 218.898 40.855 218.898 c 57.922 218.898 79.254 212.805
78 | 79.254 206.711 c 79.254 200.613 57.922 194.52 42.988 188.422 c 28.055
79 | 182.328 19.52 176.234 19.52 170.137 c 19.52 164.043 28.055 157.949
80 | 40.855 154.898 c 53.652 151.852 70.723 151.852 83.52 154.898 c 96.32
81 | 157.949 104.855 164.043 104.855 170.137 c 104.855 176.234 96.32 182.328
82 | 81.387 188.422 c 66.453 194.52 45.121 200.613 45.121 206.711 c 45.121
83 | 212.805 66.453 218.898 83.52 218.898 c 100.586 218.898 113.387 212.805
84 | 119.789 191.473 c 126.188 170.137 126.188 133.566 100.586 96.996 c S
85 | 0.96 0.678 0.705 rg
86 | 17.387 125.949 m 20.586 128.996 26.988 128.996 39.789 128.996 c 52.586
87 | 128.996 71.789 128.996 84.586 128.996 c 97.387 128.996 103.789 128.996
88 | 106.988 125.949 c 110.188 122.898 110.188 116.805 110.188 98.52 c
89 | 110.188 80.234 110.188 49.758 110.188 31.473 c 110.188 13.184 110.188
90 | 7.09 106.988 4.043 c 103.789 0.996 97.387 0.996 84.586 0.996 c 71.789
91 | 0.996 52.586 0.996 39.789 0.996 c 26.988 0.996 20.586 0.996 17.387
92 | 4.043 c 14.188 7.09 14.188 13.184 14.188 31.473 c 14.188 49.758 14.188
93 | 80.234 14.188 98.52 c 14.188 116.805 14.188 122.898 17.387 125.949 c h
94 | 17.387 125.949 m f*
95 | 1 g
96 | 100.586 64.996 m 100.586 95.293 83.395 119.852 62.188 119.852 c 40.98
97 | 119.852 23.789 95.293 23.789 64.996 c 23.789 34.699 40.98 10.137 62.188
98 | 10.137 c 83.395 10.137 100.586 34.699 100.586 64.996 c h
99 | 100.586 64.996 m f*
100 | 0.305 0.305 0.301 rg
101 | 42.188 168.996 m 42.188 174.328 34.188 174.328 34.188 168.996 c 34.188
102 | 163.66 42.188 163.66 42.188 168.996 c h
103 | 42.188 168.996 m f*
104 | 90.188 168.996 m 90.188 174.328 82.188 174.328 82.188 168.996 c 82.188
105 | 163.66 90.188 163.66 90.188 168.996 c h
106 | 90.188 168.996 m f*
107 | Q
108 | showpage
109 | %%Trailer
110 | count op_count sub {pop} repeat
111 | countdictstack dict_count sub {end} repeat
112 | cairo_eps_state restore
113 | %%EOF
114 |
--------------------------------------------------------------------------------
/figures/ponder_national_picturehang_04.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 20 02:28:49 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 126 194
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %!FontType1-1.1 f-0-0 1.0
67 | 11 dict begin
68 | /FontName /f-0-0 def
69 | /PaintType 0 def
70 | /FontType 1 def
71 | /FontMatrix [0.001 0 0 0.001 0 0] readonly def
72 | /FontBBox {-9 -8 711 733 } readonly def
73 | /Encoding 256 array
74 | 0 1 255 {1 index exch /.notdef put} for
75 | dup 1 /g1 put
76 | dup 2 /uni0042 put
77 | dup 3 /uni0043 put
78 | readonly def
79 | currentdict end
80 | currentfile eexec
81 | f983ef0097ece636fb4a96c74d26ab84185f6dfa4a16a7a1c27bbe3f1156aea698df336d20b467
82 | b10e7f33846656653c5ac6962759d3056cbdb3190bac614b984bf5a132dc418192443014ba63de
83 | 800a9c2cbaae3e98d910ec768e3ec0a68d6662ed0a4786decd0bc494681b7a8f496910cd7b4630
84 | 6dc8ae9298e870deef7a0ea25578226e409aa0b4147f7b82b7598ad503870b1045c168eb0c100e
85 | 42b0f810d306f8f7f38011c973c0fb43b3d4511ebd07847dd8587bb33de670b6b0b94ed7772fe2
86 | 92f5b1bfe83ad2c9d4f17ed4f34a3ab5b1c268ae43a5947d16525f9ffef6d057d70f07acc67574
87 | 27d7d3f6aa307d2bc8f59c82b8579918945de0cbfe985b93304f9c1070e1f6202df44843e02218
88 | ef7cdeb6de66d8f51f05d71018a8c24db1ba96804959137e26c83df71f128c4382a6c0100919a8
89 | d5a41ca72bc34b422d90fe3af91d4019fe37685fc4c887cdd9352cc0ad399930fbe5bc2460b86c
90 | 8f058df9e4b95208af839b68b6de96fe675b0bd5e824b43654ee00e35cbfdf1753cddc35958411
91 | 6f55358a6bce14fdc44cb6df5fb863a53bf5b6f4518459401adfe24fb80b6871e66c442d6f70d9
92 | 65fc78ff436339c53448f39c5bdf62e42edf0ec91b990cf3c1596e5dacbee8063fa9e53957ace0
93 | 152149e2997c2dd0b61ad2877bc6f4c7c24871621c3375fb1d3bfa802a77bbaaf6985ffe6d0b24
94 | 04bd98418a1ca1e6b35d6792c2798477470d0f1ff243f51f164fb51580df27dc831ebdbec35751
95 | 28c7cfaa53d0adc4aa45c36e168c760c1cc952e375c7205016776c354bde7628b0ef10f8232627
96 | 0db8ca07cd40543653ba572351e600456c7730dab218b1962eebfd83167ecbd64c11161f9bf4b1
97 | 1d7e80a2f10d0f60b0d8a11e57c99135e7c7e59696adb8b5384ddaaa543aef97ff94dba1d8f175
98 | b4c7736745976ba971e9e8127325c87e38cb0cf0235937549de866b2e7913e5dda43adfc6e1765
99 | e1f325a85b51ef729ac3882839f807acbf9187b0bd193248aad5e1e287056a7ce5469efd7c60bc
100 | 87aa302ed78e0d37c2fb41d235de0dd8cd4de74e863e0caec47db1e2ccdfffcd2cb57fe142ed95
101 | 9c3bd02af87d96cba869a17be0e6675ee6079142a882de70a4114d14e4ddd86e899967e4f729a5
102 | f2a6529fb7cde3a1a0db44cbcea9c0b1ccd73958c526f4edeba25d5e90448785723c1e0ad2cb7a
103 | 0d40951fb7b0fe4e2362902ac36dd63fa5d18df21dde1ba721265f197155faa0c5c5ec862fcfb8
104 | 3236b3b4ee554d44c7452c60889c0f43d756388c609264602b8a4344d4edbd772a1231238b315a
105 | 17d8cdb33817b37eaca5e57fb5f4b162066faac62555a4388a79fadc482b2294ec3001d5cc745f
106 | 3813acbdb1e87c30d704c393bdc3343d3f9ee99a313ee4e6b2e6f38f6969baee346efc3dcc6956
107 | 82e8b20c87d01485cfd525a79f0e17f5f7f10e7f398f96f264b2ea518e647a7293e41a1bbc5b99
108 | 93f7a74841849e99c3d740f5cd2a588f5b5f362af6e18fd4e7de25e1281f58339e0c21e623bf77
109 | df7dc59ff74832c824e63c591a841756e2b116823b5119ad621a35ff2e1fb51fbf61e86033e6cf
110 | e1e379107a1bef6eb12a94ac18a01e16695846b21f4d323cf1beced51d154a22ddeacd1d0eb046
111 | c94c3b8aff4b2d4db94f305e36a35557ed18b9ba62b39de44a403a633386f225d69e627796e484
112 | a73f6ed519ee451820878fccdcfcd32c89b3a8c5f95299f4b645d0c4c3638a79a7f62d2fe0a098
113 | e69beda8f8bde7be1eb30fe3352bdf0cbb16a6abe6bcbfbadf4e3d21aab03233d155e6d9e9fe23
114 | b67aa4602c50935a5ccfcc4ec71c01936e267be2d93429c665bda9d4d06a4b073efe69f0794d4a
115 | fd263dac01b0d756ed149477d669b132363ea7c817945c92dafcb51f7c62cb0ff23646e8ef1f66
116 | 3e4c1d9ed10fe9428b4fbef8b864fee5f402088f82ac4ec5e777ea520dd7d0b6811f2702e43de6
117 | 1b54663e8470da653d830822f4782fcdb6d374014fbda67ea34b31de78a839681da4a087156f8c
118 | 5053a54e1f2186fdb2741b5cf0bda7bfc21df1cae24ef6e75d8148b94df40d8cbece13022a6f46
119 | 90736418141d7f2c2618f0a93a8b59456fe444bfaa837851172090370000000000000000000000000000000000000000000000000000000000000000
120 | 0000000000000000000000000000000000000000000000000000000000000000
121 | 0000000000000000000000000000000000000000000000000000000000000000
122 | 0000000000000000000000000000000000000000000000000000000000000000
123 | 0000000000000000000000000000000000000000000000000000000000000000
124 | 0000000000000000000000000000000000000000000000000000000000000000
125 | 0000000000000000000000000000000000000000000000000000000000000000
126 | 0000000000000000000000000000000000000000000000000000000000000000
127 | cleartomark
128 | %%Page: 1 1
129 | %%BeginPageSetup
130 | %%PageBoundingBox: 0 0 126 194
131 | %%EndPageSetup
132 | q
133 | 0 g
134 | 1.2 w
135 | 1 J
136 | 1 j
137 | [] 0.0 d
138 | 10 M 14.793 96.898 m -17.207 128.898 14.793 160.898 30.793 192.898 c S
139 | 110.793 96.898 m 142.793 128.898 110.793 160.898 94.793 192.898 c S
140 | 0.96 0.843 0.678 rg
141 | 17.992 125.852 m 21.191 128.898 27.59 128.898 40.391 128.898 c 53.191
142 | 128.898 72.391 128.898 85.191 128.898 c 97.992 128.898 104.391 128.898
143 | 107.59 125.852 c 110.793 122.805 110.793 116.711 110.793 98.422 c
144 | 110.793 80.137 110.793 49.66 110.793 31.375 c 110.793 13.09 110.793
145 | 6.996 107.59 3.949 c 104.391 0.898 97.992 0.898 85.191 0.898 c 72.391
146 | 0.898 53.191 0.898 40.391 0.898 c 27.59 0.898 21.191 0.898 17.992 3.949
147 | c 14.793 6.996 14.793 13.09 14.793 31.375 c 14.793 49.66 14.793 80.137
148 | 14.793 98.422 c 14.793 116.711 14.793 122.805 17.992 125.852 c h
149 | 17.992 125.852 m f*
150 | 1 g
151 | 101.191 64.902 m 101.191 95.199 84 119.758 62.793 119.758 c 41.582
152 | 119.758 24.391 95.199 24.391 64.902 c 24.391 34.605 41.582 10.043
153 | 62.793 10.043 c 84 10.043 101.191 34.605 101.191 64.902 c h
154 | 101.191 64.902 m f*
155 | 0.305 0.305 0.301 rg
156 | 42.793 168.898 m 42.793 174.234 34.793 174.234 34.793 168.898 c 34.793
157 | 163.566 42.793 163.566 42.793 168.898 c h
158 | 42.793 168.898 m f*
159 | 90.793 168.898 m 90.793 174.234 82.793 174.234 82.793 168.898 c 82.793
160 | 163.566 90.793 163.566 90.793 168.898 c h
161 | 90.793 168.898 m f*
162 | 66.793 168.898 m 66.793 174.234 58.793 174.234 58.793 168.898 c 58.793
163 | 163.566 66.793 163.566 66.793 168.898 c h
164 | 66.793 168.898 m f*
165 | 0 g
166 | BT
167 | 8.9664 0 0 8.9664 35.644406 152.9 Tm
168 | /f-0-0 1 Tf
169 | [<01>-1994<02>]TJ
170 | 5.374788 0.00100375 Td
171 | <03>Tj
172 | ET
173 | Q
174 | showpage
175 | %%Trailer
176 | count op_count sub {pop} repeat
177 | countdictstack dict_count sub {end} repeat
178 | cairo_eps_state restore
179 | %%EOF
180 |
--------------------------------------------------------------------------------
/figures/quickfire_central_regional_closedshapearea_01.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Sat Apr 13 01:34:40 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 1 103 91
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 1 103 91
69 | %%EndPageSetup
70 | q
71 | 0.827 g
72 | 0.8 w
73 | 1 J
74 | 1 j
75 | [] 0.0 d
76 | 10 M 35.699 4.18 m 67.719 4.18 l 83.711 31.891 l 51.711 31.898 l 67.719
77 | 59.598 l 51.719 87.301 l 35.719 59.605 l 3.699 59.598 l 19.711 31.891 l
78 | 35.719 59.598 l 67.719 59.598 l 99.719 59.598 l 83.711 31.891 l 67.719
79 | 59.598 l S
80 | 67.719 4.18 m 51.711 31.891 l 35.719 4.18 l 19.711 31.891 l 51.711
81 | 31.898 l 35.719 59.598 l S
82 | 0 g
83 | 54.711 31.891 m 54.711 35.891 48.711 35.891 48.711 31.891 c 48.711
84 | 27.891 54.711 27.891 54.711 31.891 c h
85 | 54.711 31.891 m f*
86 | 38.699 4.18 m 38.699 8.18 32.699 8.18 32.699 4.18 c 32.699 0.18 38.699
87 | 0.18 38.699 4.18 c h
88 | 38.699 4.18 m f*
89 | 22.711 31.891 m 22.711 35.891 16.711 35.891 16.711 31.891 c 16.711
90 | 27.891 22.711 27.891 22.711 31.891 c h
91 | 22.711 31.891 m f*
92 | 6.699 59.598 m 6.699 63.598 0.699 63.598 0.699 59.598 c 0.699 55.598
93 | 6.699 55.598 6.699 59.598 c h
94 | 6.699 59.598 m f*
95 | 38.699 59.598 m 38.699 63.598 32.699 63.598 32.699 59.598 c 32.699
96 | 55.598 38.699 55.598 38.699 59.598 c h
97 | 38.699 59.598 m f*
98 | 70.699 59.598 m 70.699 63.598 64.699 63.598 64.699 59.598 c 64.699
99 | 55.598 70.699 55.598 70.699 59.598 c h
100 | 70.699 59.598 m f*
101 | 102.719 59.598 m 102.719 63.598 96.719 63.598 96.719 59.598 c 96.719
102 | 55.598 102.719 55.598 102.719 59.598 c h
103 | 102.719 59.598 m f*
104 | 54.719 87.301 m 54.719 91.301 48.719 91.301 48.719 87.301 c 48.719
105 | 83.301 54.719 83.301 54.719 87.301 c h
106 | 54.719 87.301 m f*
107 | 86.711 31.891 m 86.711 35.891 80.711 35.891 80.711 31.891 c 80.711
108 | 27.891 86.711 27.891 86.711 31.891 c h
109 | 86.711 31.891 m f*
110 | 70.719 4.18 m 70.719 8.18 64.719 8.18 64.719 4.18 c 64.719 0.18 70.719
111 | 0.18 70.719 4.18 c h
112 | 70.719 4.18 m f*
113 | Q
114 | showpage
115 | %%Trailer
116 | count op_count sub {pop} repeat
117 | countdictstack dict_count sub {end} repeat
118 | cairo_eps_state restore
119 | %%EOF
120 |
--------------------------------------------------------------------------------
/figures/quickfire_central_regional_nestbox.eps:
--------------------------------------------------------------------------------
1 | %!PS-Adobe-3.0 EPSF-3.0
2 | %%Creator: cairo 1.8.8 (http://cairographics.org)
3 | %%CreationDate: Fri Apr 12 22:09:00 2019
4 | %%Pages: 1
5 | %%BoundingBox: 0 0 102 50
6 | %%DocumentData: Clean7Bit
7 | %%LanguageLevel: 2
8 | %%EndComments
9 | %%BeginProlog
10 | /cairo_eps_state save def
11 | /dict_count countdictstack def
12 | /op_count count 1 sub def
13 | userdict begin
14 | /q { gsave } bind def
15 | /Q { grestore } bind def
16 | /cm { 6 array astore concat } bind def
17 | /w { setlinewidth } bind def
18 | /J { setlinecap } bind def
19 | /j { setlinejoin } bind def
20 | /M { setmiterlimit } bind def
21 | /d { setdash } bind def
22 | /m { moveto } bind def
23 | /l { lineto } bind def
24 | /c { curveto } bind def
25 | /h { closepath } bind def
26 | /re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
27 | 0 exch rlineto 0 rlineto closepath } bind def
28 | /S { stroke } bind def
29 | /f { fill } bind def
30 | /f* { eofill } bind def
31 | /B { fill stroke } bind def
32 | /B* { eofill stroke } bind def
33 | /n { newpath } bind def
34 | /W { clip } bind def
35 | /W* { eoclip } bind def
36 | /BT { } bind def
37 | /ET { } bind def
38 | /pdfmark where { pop globaldict /?pdfmark /exec load put }
39 | { globaldict begin /?pdfmark /pop load def /pdfmark
40 | /cleartomark load def end } ifelse
41 | /BDC { mark 3 1 roll /BDC pdfmark } bind def
42 | /EMC { mark /EMC pdfmark } bind def
43 | /cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
44 | /Tj { show currentpoint cairo_store_point } bind def
45 | /TJ {
46 | {
47 | dup
48 | type /stringtype eq
49 | { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
50 | } forall
51 | currentpoint cairo_store_point
52 | } bind def
53 | /cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
54 | cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
55 | /Tf { pop /cairo_font exch def /cairo_font_matrix where
56 | { pop cairo_selectfont } if } bind def
57 | /Td { matrix translate cairo_font_matrix matrix concatmatrix dup
58 | /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
59 | /cairo_font where { pop cairo_selectfont } if } bind def
60 | /Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
61 | cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
62 | /g { setgray } bind def
63 | /rg { setrgbcolor } bind def
64 | /d1 { setcachedevice } bind def
65 | %%EndProlog
66 | %%Page: 1 1
67 | %%BeginPageSetup
68 | %%PageBoundingBox: 0 0 102 50
69 | %%EndPageSetup
70 | q
71 | 0.96 0.678 0.705 rg
72 | 4.602 49.398 m 0.602 41.398 l 4.602 49.398 l 4.602 1.398 l 96.602 1.398
73 | l 96.602 49.398 l 100.602 41.398 l 96.602 49.398 l f*
74 | 0 g
75 | 1.2 w
76 | 0 J
77 | 1 j
78 | [] 0.0 d
79 | 10 M 4.602 49.398 m 0.602 41.398 l 4.602 49.398 l 4.602 1.398 l 96.602 1.398
80 | l 96.602 49.398 l 100.602 41.398 l 96.602 49.398 l S
81 | 0.596 0.78 0.964 rg
82 | 12.602 41.398 m 8.602 33.398 l 12.602 41.398 l 12.602 9.398 l 44.602
83 | 9.398 l 44.602 41.398 l 48.602 33.398 l 44.602 41.398 l f*
84 | 0 g
85 | 12.602 41.398 m 8.602 33.398 l 12.602 41.398 l 12.602 9.398 l 44.602
86 | 9.398 l 44.602 41.398 l 48.602 33.398 l 44.602 41.398 l S
87 | 0.596 0.964 0.756 rg
88 | 20.602 33.398 m 16.602 25.398 l 20.602 33.398 l 20.602 17.398 l 36.602
89 | 17.398 l 36.602 33.398 l 40.602 25.398 l 36.602 33.398 l f*
90 | 0 g
91 | 20.602 33.398 m 16.602 25.398 l 20.602 33.398 l 20.602 17.398 l 36.602
92 | 17.398 l 36.602 33.398 l 40.602 25.398 l 36.602 33.398 l S
93 | 0.596 0.78 0.964 rg
94 | 56.602 41.398 m 52.602 33.398 l 56.602 41.398 l 56.602 9.398 l 88.602
95 | 9.398 l 88.602 41.398 l 92.602 33.398 l 88.602 41.398 l f*
96 | 0 g
97 | 56.602 41.398 m 52.602 33.398 l 56.602 41.398 l 56.602 9.398 l 88.602
98 | 9.398 l 88.602 41.398 l 92.602 33.398 l 88.602 41.398 l S
99 | 0.596 0.964 0.756 rg
100 | 64.602 33.398 m 60.602 25.398 l 64.602 33.398 l 64.602 17.398 l 80.602
101 | 17.398 l 80.602 33.398 l 84.602 25.398 l 80.602 33.398 l f*
102 | 0 g
103 | 64.602 33.398 m 60.602 25.398 l 64.602 33.398 l 64.602 17.398 l 80.602
104 | 17.398 l 80.602 33.398 l 84.602 25.398 l 80.602 33.398 l S
105 | Q
106 | showpage
107 | %%Trailer
108 | count op_count sub {pop} repeat
109 | countdictstack dict_count sub {end} repeat
110 | cairo_eps_state restore
111 | %%EOF
112 |
--------------------------------------------------------------------------------
/figures/svgcolors.isy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/fonts/FiraCode-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/FiraCode-Bold.otf
--------------------------------------------------------------------------------
/fonts/FiraCode-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/FiraCode-Regular.otf
--------------------------------------------------------------------------------
/fonts/FiraGO-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/FiraGO-Bold.otf
--------------------------------------------------------------------------------
/fonts/FiraGO-Book.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/FiraGO-Book.otf
--------------------------------------------------------------------------------
/fonts/FiraMono-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/FiraMono-Bold.otf
--------------------------------------------------------------------------------
/fonts/FiraMono-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/FiraMono-Regular.otf
--------------------------------------------------------------------------------
/fonts/Kanit-Light.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Kanit-Light.otf
--------------------------------------------------------------------------------
/fonts/Kanit-LightItalic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Kanit-LightItalic.otf
--------------------------------------------------------------------------------
/fonts/Kanit-SemiBold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Kanit-SemiBold.otf
--------------------------------------------------------------------------------
/fonts/Kanit-SemiBoldItalic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Kanit-SemiBoldItalic.otf
--------------------------------------------------------------------------------
/fonts/Sarabun-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-Bold.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-BoldItalic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-ExtraBold.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-ExtraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-ExtraLight.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-ExtraLightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-ExtraLightItalic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-Italic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-Light.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-LightItalic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-Medium.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-MediumItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-MediumItalic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-Regular.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-SemiBold.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-Thin.ttf
--------------------------------------------------------------------------------
/fonts/Sarabun-ThinItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KBTG-TechJam/techjam2018-codesquad-questions/35e86729ab5aa416818be16019a7e72e6296a215/fonts/Sarabun-ThinItalic.ttf
--------------------------------------------------------------------------------
/main.tex:
--------------------------------------------------------------------------------
1 | % !TEX program = xelatex
2 | \documentclass{techjam-codequestions}
3 |
4 | %% Global constants
5 | \newrobustcmd{\techjam}{\textbf{\ltspc TECHJAM 2018}}
6 |
7 | \begin{document}
8 |
9 | \chapter*{บทนำ}
10 | \input{00_introduction.tex}
11 |
12 | \chapter{โจทย์ Quickfire}
13 | \input{01_quickfire.tex}
14 |
15 | \chapter{โจทย์ Ponder}
16 | \input{02_ponder.tex}
17 |
18 | \chapter{โจทย์ Coding}
19 | \input{03_coding.tex}
20 |
21 | \vspace*{\fill}
22 | \begin{center}
23 | --- 30 ---
24 | \end{center}
25 |
26 | \end{document}
27 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_audition_linearswap.tex:
--------------------------------------------------------------------------------
1 | \question{\label{q:quickfire-central-audition-linearswap}}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้
4 | \begin{lstlisting}
5 | function mystery_<%\ref*{q:quickfire-central-audition-linearswap}%>(A[0...n-1]):
6 | # A <%\codecmt คือ%> 0-indexed array <%\codecmt ของจำนวนเต็ม%>
7 | n := A.length()
8 | for i := 0 to n-2 do:
9 | if A[i] > A[i+1] then:
10 | swap A[i] with A[i+1]
11 | end
12 | end
13 | return A
14 | end
15 | \end{lstlisting}
16 |
17 | \medskip\noindent
18 | จากโปรแกรมข้างต้นนี้ ประพจน์ใดกล่าวถูกต้อง\uline{บ้าง}?
19 |
20 | \begin{enumerate}[label={$\square$}]
21 | \item \textbf{ประพจน์ P:} มีค่าค่าหนึ่งใน output array ซึ่งเมื่อลบออกจาก array ดังกล่าว จะทำให้ array ผลลัพธ์เป็น array ที่เรียงลำดับ
22 | \item \textbf{ประพจน์ Q:} สำหรับ input array A ใด ๆ ที่มีขนาด N จะได้ว่า \lstinline{f(A)[N-1] = max(A)}
23 | \item \textbf{ประพจน์ R:} สำหรับ input array A ใด ๆ ที่มีขนาด N จะได้ว่า \lstinline{f(A)[0] = min(A)}
24 | \end{enumerate}
25 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_audition_sortbetweenintro.tex:
--------------------------------------------------------------------------------
1 | \question{\label{q:quickfire_central_audition_sortbetweenintro}}
2 |
3 | กำหนดให้มีฟังก์ชันหนึ่ง \lstinline{sort_between(L, p, q)} ซึ่งมีสเปกดังนี้
4 | \begin{itemize}
5 | \item ข้อมูล input \lstinline{L} เป็น 0-indexed array ของจำนวนชุดหนึ่ง
6 | \item ข้อมูล input \lstinline{p} และ \lstinline{q} เป็น index
7 | ภายใน array \lstinline{L} โดยที่มีเงื่อนไขว่า \\
8 | \lstinline{0 <= p <= q < L.length()}
9 | \item ข้อมูล output ของ \lstinline{sort_between(L, p, q)}
10 | จะเป็น array ใหม่ ซึ่งเกิดจากการจัดเรียงจำนวนบางจำนวนใน array \lstinline{L} เดิม
11 | ตั้งแต่ตำแหน่ง \lstinline{p} ถึงตำแหน่ง \lstinline{q} จากน้อยไปมาก
12 | และจำนวนในตำแหน่งอื่น ๆ นอกเหนือจากนี้ยังคงเดิม
13 | \end{itemize}
14 |
15 | \noindent
16 | \textbf{\uline{ยกตัวอย่าง}}\; ถ้ากำหนดให้ \lstinline{L_0 = [4, 2, 7, 3, 8, 1, 5]}
17 | แล้วเมื่อเรียกฟังก์ชัน \lstinline{sort_between(L_0, 2, 5)}
18 | จะได้ output เป็น \lstinline{[4, 2, 1, 3, 7, 8, 5]}
19 |
20 | \medskip\noindent
21 | \textbf{\uline{โจทย์}}\; สมมติว่าเรามี array \lstinline{L_1}
22 | ซึ่งประกอบไปด้วยจำนวนทั้งสิ้น 250 จำนวน โปรแกรมในข้อใดต่อไปนี้\hrsp\uline{ไม่รับประกัน}\hrsp%
23 | ว่าสามารถเรียงลำดับจำนวนทุกจำนวนภายใน array ได้ทั้งหมด?
24 | \begin{enumerate}[label={$\Circle$}]
25 | \item \lstinline{sort_between(L_1, 0, 249)}
26 | \item
27 | \lstinline{sort_between(L_1, 0, 199)} \\
28 | \lstinline{sort_between(L_1, 150, 249)} \\
29 | \lstinline{sort_between(L_1, 0, 199)}
30 | \item
31 | \lstinline{sort_between(L_1, 0, 199)} \\
32 | \lstinline{sort_between(L_1, 50, 249)} \\
33 | \lstinline{sort_between(L_1, 0, 149)}
34 | \item
35 | \lstinline{sort_between(L_1, 100, 249)} \\
36 | \lstinline{sort_between(L_1, 0, 149)} \\
37 | \lstinline{sort_between(L_1, 50, 249)}
38 | \item
39 | \lstinline{sort_between(L_1, 150, 249)} \\
40 | \lstinline{sort_between(L_1, 0, 199)} \\
41 | \lstinline{sort_between(L_1, 150, 249)}
42 | \end{enumerate}
43 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_audition_squaretiling.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | สมมติว่าเราต้องการสร้างรูปเรขาคณิตใหม่ โดยนำชิ้นส่วนจัตุรัสขนาด 1 ตารางหน่วยอย่างน้อย 1 ชิ้นมาประกอบกัน โดยมีเงื่อนไขดังต่อไปนี้
4 | \begin{itemize}
5 | \item รูปเรขาคณิตใหม่จะต้องไม่มีชิ้นส่วนที่แยกจากกัน
6 | (ยกตัวอย่างเช่นรูป \textbf{(c)} \uline{ใช้ไม่ได้})
7 | \item ชิ้นส่วนจัตุรัสสองชิ้นที่แตะกันเฉพาะตำแหน่งมุม ถือว่าเป็นชิ้นส่วนที่แยกจากกัน
8 | (รูปตัวอย่าง \textbf{(d)} \uline{ใช้ไม่ได้})
9 | \item รูปเรขาคณิตใหม่จะต้องไม่มีรูหรือช่องว่างภายในรูปปิด
10 | (ตัวอย่างเช่นรูป \textbf{(e)} \uline{ใช้ไม่ได้})
11 | \item รูปเรขาคณิตใหม่จะต้องมีทุกด้านยาว 1 หน่วยเท่านั้น
12 | (เช่นรูป \textbf{(f)} หรือ \textbf{(g)} \uline{ใช้ไม่ได้}
13 | เพราะมีบางด้านยาว 0.5 หน่วย หรือ 2 หน่วย)
14 | \end{itemize}
15 | \marginnote[-8\baselineskip]{%
16 | \centering
17 | \includegraphics[width=0.70\linewidth]{figures/quickfire_central_audition_squaretiling.eps}
18 | }
19 |
20 | สังเกตว่า หากเรามีชิ้นส่วนจัตุรัส 1 ชิ้นพอดี หรือ 5 ชิ้นพอดี
21 | (จากรูปตัวอย่าง \textbf{(a)} และ \textbf{(b)} ตามลำดับ)
22 | เราสามารถสร้างรูปเรขาคณิตที่สอดคล้องกับเงื่อนไขข้างต้นได้\;
23 | อย่างไรก็ดี เรา\uline{ไม่สามารถ}สร้างรูปเรขาคณิตตามเงื่อนไขดังกล่าวได้เลย
24 | หากเรามีชิ้นส่วนจัตุรัสเพียง 2 หรือ 3 หรือ 4 ชิ้นเท่านั้น
25 |
26 | จงหาจำนวนชิ้นส่วนจัตุรัสที่\hrsp\uline{มากที่สุด}{\hrsp}ที่\hrsp\uline{ไม่สามารถ}{\hrsp}นำมาประกอบเป็นรูปเรขาคณิตตามเงื่อนไขข้างต้นได้
27 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_audition_treereducer.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | เรานิยาม \textbf{Proper binary tree} คือต้นไม้ทวิภาคที่ทุกโหนดมีโหนดลูกเป็นจำนวน 0 หรือ 2 โหนดพอดีเท่านั้น\;
4 | (กล่าวคือทุกโหนดที่เป็น Internal/Non-leaf Node จะต้องมีโหนดลูก 2 โหนดพอดี)
5 |
6 | สมมติว่าเรามี Programming Library ตัวหนึ่งที่สามารถจัดการข้อมูลที่มีโครงสร้างเป็น Proper binary tree
7 | ซึ่งมีรายละเอียดดังต่อไปนี้
8 |
9 | \begin{description}
10 | \item[Data type.] โหนดแต่ละโหนดของ Proper binary tree จะมี data type ที่มีชื่อว่า
11 | \lstinline{Node} ซึ่งแบ่ง subtype ได้ 2 แบบย่อย ดังนี้
12 | \begin{itemize}
13 | \item \lstinline|Leaf{value: Integer}| \\
14 | เป็น Leaf node ซึ่งประกอบด้วยข้อมูล 1 อย่าง ซึ่งก็คือจำนวนเต็มภายในโหนด
15 | \item \lstinline|Internal{left: Node, right: Node, value: Integer}| \\
16 | เป็น Non-leaf node ซึ่งประกอบด้วยข้อมูลทั้งสิ้น 3 อย่าง ได้แก่
17 | 1.~Subtree ทางซ้าย 2.~Subtree ทางขวา
18 | และ 3.~ข้อมูลจำนวนเต็มภายในโหนด ตามลำดับ
19 | \end{itemize}
20 | \item[Library function.] กำหนดให้ฟังก์ชัน \lstinline{compute}
21 | รับข้อมูลต้นไม้ประเภท \lstinline{Node} และฟังก์ชันอื่น ๆ อีก 2 ฟังก์ชัน (ดูโค้ดด้านล่างประกอบ)
22 | เพื่อประมวลผลข้อมูลต้นไม้ดังกล่าว ซึ่งสามารถเขียนเป็น pseudocode ได้ดังต่อไปนี้
23 | \end{description}
24 |
25 | \newpage
26 | \vspace*{-2\baselineskip}
27 | \begin{fullwidth}%
28 | \begin{lstlisting}[language=pseudocode]
29 | function compute(tree: Node,
30 | leaf_transformer: function, # signature: Integer -> T
31 | internal_transformer: function): # signature: T, T, Integer -> T
32 | if tree matches Leaf{value} then:
33 | return leaf_transformer(value)
34 | else if tree matches Internal{left, right, value} then:
35 | return internal_transformer(
36 | compute(left, leaf_transformer, internal_transformer),
37 | compute(right, leaf_transformer, internal_transformer),
38 | value
39 | )
40 | end
41 | end
42 | \end{lstlisting}
43 | \end{fullwidth}
44 |
45 | \noindent%
46 | \textbf{\uline{โจทย์}}\; สมมติว่าเรามีข้อมูล Proper binary tree ที่เก็บอยู่ในตัวแปรชื่อ \lstinline{data}
47 | แล้วโปรแกรมในข้อใดต่อไปนี้จะนับจำนวนโหนดทั้งหมดภายในต้นไม้ (ทั้ง Leaf และ Non-leaf)
48 | ภายในตัวแปร \lstinline{data} ดังกล่าวได้ถูกต้อง?\hrsp%
49 | \sidenote[][-2\baselineskip]{%
50 | \textbf{หมายเหตุ}\; ยกตัวอย่าง syntax ของฟังก์ชันนิรนาม เช่น \lstinline{lambda(x, y) -> (x + y)/2}
51 | คือฟังก์ชันที่หาค่าเฉลี่ยของตัวเลข input argument สองตัว
52 | }
53 |
54 | \begin{fullwidth}
55 | \bigskip
56 | \begin{enumerate}[label={$\Circle$}]
57 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r)}
58 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r) * 2}
59 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r) * 2 + 1}
60 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r) * 2 - 1}
61 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r + v)}
62 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r + v) * 2}
63 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r + v) * 2 + 1}
64 | \item \lstinline{compute(data, lambda(v) → v, lambda(l, r, v) → l + r + v) * 2 - 1}
65 | \item \lstinline{compute(data, lambda(v) → 1, lambda(l, r, v) → l + r) * 2}
66 | \item \lstinline{compute(data, lambda(v) → 1, lambda(l, r, v) → l + r) * 2 + 1}
67 | \item \lstinline{compute(data, lambda(v) → 1, lambda(l, r, v) → l + r) * 2 - 1}
68 | \item \lstinline{compute(data, lambda(v) → 1, lambda(l, r, v) → l + r + 1) * 2}
69 | \item \lstinline{compute(data, lambda(v) → 1, lambda(l, r, v) → l + r - 1) * 2}
70 | \item \lstinline{compute(data, lambda(v) → 0, lambda(l, r, v) → l + r) * 2}
71 | \item \lstinline{compute(data, lambda(v) → 0, lambda(l, r, v) → l + r) * 2 + 1}
72 | \item \lstinline{compute(data, lambda(v) → 0, lambda(l, r, v) → l + r) * 2 - 1}
73 | \item \lstinline{compute(data, lambda(v) → 0, lambda(l, r, v) → l + r + 1) * 2}
74 | \item \lstinline{compute(data, lambda(v) → 0, lambda(l, r, v) → l + r - 1) * 2}
75 | \end{enumerate}
76 | \end{fullwidth}
77 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_regional_bfsdfs.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณานิยามของลำดับ (ordering) ในการท่องต้นไม้ค้นหาแบบทวิภาค (Binary search tree)
4 | ที่แตกต่างกันดังต่อไปนี้
5 |
6 | \marginnote{%
7 | \textbf{ตัวอย่าง} เช่นจากรูปต้นไม้ตัวอย่างนี้
8 |
9 | \begin{center}
10 | \includegraphics[width=0.6667\linewidth]{figures/quickfire_central_regional_bfsdfs.eps}
11 | \end{center}
12 |
13 | \begin{itemize}
14 | \item จะมี Pre-order traversal ordering เป็น $[\mathrm{5, 2, 1, 4, 3}]$
15 | \item และจะมี Breadth-first search ordering ได้สองรูปแบบ
16 | ได้แก่ $[\mathrm{5, 2, 1, 4, 3}]$ และ $[\mathrm{5, 2, 4, 1, 3}]$
17 | \end{itemize}
18 | }
19 |
20 | \begin{itemize}
21 | \item \textbf{Pre-order traversal}
22 | ของโครงสร้างข้อมูลต้นไม้ค้นหาทวิภาค (Binary search tree) คือการใช้อัลกอริทึม
23 | Depth-first search (DFS) เพื่อประมวลผลโหนดแต่ละโหนดของต้นไม้หนึ่งตามลำดับดังต่อไปนี้
24 | (โดยนับเริ่มต้นจากราก (root) ของต้นไม้)
25 |
26 | \begin{enumerate}
27 | \item compute โหนดตัวเอง
28 | \item recursively compute โหนดในกลุ่ม Subtree ทางซ้ายของโหนดตัวเอง
29 | \item recursively compute โหนดในกลุ่ม Subtree ทางขวาของโหนดตัวเอง
30 | \end{enumerate}
31 |
32 | \item \textbf{Breadth-first search ordering}
33 | ของโครงสร้างข้อมูลต้นไม้ทวิภาค (Binary tree) คือลำดับการท่องต้นไม้ตามอัลกอริทึม
34 | Breadth-first search (BFS) (\textbf{หมายเหตุ:} โดยมีเงื่อนไขกำหนดให้เริ่มต้นจากรากของต้นไม้)
35 | \end{itemize}
36 |
37 | \noindent
38 | \textbf{\uline{โจทย์}} สมมติว่ามีต้นไม้ค้นหาแบบทวิภาค (Binary search tree) $T$ อยู่ต้นหนึ่ง
39 | ซึ่งพบว่ามีลำดับ Pre-order traversal เป็น $[\mathrm{7, 2, 1, 4, 3, 6, 5, 9, 8, 10, 11}]$\;
40 | อยากทราบว่าต้นไม้ $T$ นี้จะมี Breadth-first search (BFS) ordering
41 | ที่เริ่มต้นจากรากได้ต่างกันทั้งหมด\uline{กี่รูปแบบ}?
42 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_regional_closedshapearea.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | คำถามเกี่ยวกับการลากเส้นรูปปิดตามโครงสร้างที่กำหนดให้
4 |
5 | \smallskip\noindent
6 | \textbf{\uline{ตัวอย่าง}}\; จากรูปที่แสดงทาง\ifpageodd{ขวา}{ซ้าย}มือนี้
7 | \marginnote{%
8 | \centering
9 | \includegraphics{figures/quickfire_central_regional_closedshapearea_01.eps}
10 | }
11 | มีโครงสร้างเรขาคณิตที่เรียงตัวเป็นสามเหลี่ยมด้านเท่าย่อย ๆ หลายรูปประกอบกัน
12 | โดยที่สามเหลี่ยมย่อยแต่ละรูปมีพื้นที่รูปละ 1 ตารางหน่วย
13 |
14 | จากโครงสร้างเรขาคณิตรูปนี้ เราจะพยายามลากเส้นภายในโครงสร้างที่กำหนดให้ข้างต้น โดยมีเงื่อนไขว่า
15 | \begin{itemize}
16 | \item เราจะต้องลากเส้นเพียงเส้นเดียว ผ่านจุดยอดให้ครบทุกจุด แล้วกลับมายังจุดเริ่มต้น กลายเป็นรูปปิด
17 | \item จุดยอดแต่ละจุดจะต้องถูกเยือน 1 ครั้งพอดี ไม่ขาดและไม่เกิน
18 | \item เส้นทุกเส้นที่ลากผ่านจะต้องมีเค้าโครงเดิมจากเส้นสีเทาที่กำหนดให้จากรูปดั้งเดิม
19 | \item รูปปิดที่เกิดขึ้นจะต้องมี\uline{พื้นที่ภายในมากที่สุด}เท่าที่เป็นไปได้
20 | \end{itemize}
21 |
22 | \marginnote{%
23 | \centering
24 | \includegraphics{figures/quickfire_central_regional_closedshapearea_02.eps}
25 | }
26 |
27 | รูปที่สองที่ปรากฏทางด้าน\ifpageodd{ขวา}{ซ้าย}มือนี้
28 | แสดงหนึ่งในวิธีที่เราสามารถลากเส้นรูปปิดภายในโครงสร้างเรขาคณิต (ดังที่แสดงในรูปแรก)
29 | ที่สอดคล้องกับเงื่อนไขที่กล่าวมาข้างต้นได้ทั้งหมด ซึ่งรูปปิดดังกล่าวจะได้พื้นที่ภายในรวม 8 ตารางหน่วย\;
30 | (\textbf{หมายเหตุ:} อาจมีวิธีลากเส้นวิธีอื่น~ๆ ที่ทำให้ได้พื้นที่ขนาดเท่ากัน)
31 |
32 | \medskip\noindent
33 | \textbf{\uline{โจทย์}}\;
34 | จงหาว่าในรูปต่อไปนี้ เราจะลากเส้นสร้างรูปปิดตามเงื่อนไขเดียวกันให้ได้พื้นที่ภายในมากที่สุด จะได้พื้นที่เท่าใด?
35 | \begin{center}
36 | \includegraphics[width=0.7\linewidth]{figures/quickfire_central_regional_closedshapearea_03.eps}
37 | \end{center}
--------------------------------------------------------------------------------
/questions01_quickfire/central_regional_cssiblings.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | สมมติว่าครอบครัวหนึ่ง มีลูกทั้งสิ้น 5 คน ได้แก่
4 | Dijkstra (D), Hopper (H), Lovelace (L), Neumann (N) และ Shannon (S)
5 | ซึ่งไม่เรียงลำดับใด ๆ ทั้งสิ้น
6 |
7 | ต่อไปนี้จะเป็นคำบอกเล่าของแม่ 7 ประโยค ซึ่งมี \uline{1 ประโยคเท่านั้นที่เป็นเท็จ}
8 |
9 | \begin{enumerate}
10 | \item Hopper มีอายุน้อยกว่า Shannon
11 | \item Dijkstra มีอายุน้อยกว่า Lovelace
12 | \item Shannon มีอายุน้อยกว่า Neumann
13 | \item Hopper มีอายุน้อยกว่า Dijkstra
14 | \item Lovelace มีอายุน้อยกว่า Shannon
15 | \item Shannon มีอายุน้อยกว่า Dijkstra
16 | \item Neumann มีอายุน้อยกว่า Lovelace
17 | \end{enumerate}
18 |
19 | \noindent
20 | จงตอบคำถามว่า 1. ประโยคข้างต้นใดเป็นเท็จ และ 2. ใครเป็นพี่คนโต
21 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_regional_nestbox.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | เรากำหนดให้มีกล่องจำนวนหนึ่งวางอยู่บนโต๊ะ ซึ่งกล่องบางใบอาจจะถูกซ้อนอยู่ภายในกล่องใบอื่นก็ได้ และมีเงื่อนไขเพื่อความชัดเจนว่า
4 | \begin{itemize}
5 | \item \uline{ถ้า}กล่อง X ถูกซ้อนในกล่อง Y \uline{และ}กล่อง Y ถูกซ้อนในกล่อง Z
6 | \uline{แล้ว}กล่อง X จะถือว่าถูกซ้อนในกล่อง Z ด้วย
7 | \item \uline{ถ้า}กล่อง X ถูกซ้อนในกล่อง Y \uline{แล้ว}กล่อง Y จะไม่ถูกซ้อนในกล่อง X
8 | \end{itemize}
9 | นอกจากเงื่อนไขข้างต้นนี้ เรากำหนดนิยามเพิ่มเติมดังต่อไปนี้
10 | \begin{quote}
11 | \textbf{\uline{นิยาม}}\; หากกำหนดให้ $B$ เป็นสัญลักษณ์ที่สื่อถึงรูปแบบของการจัดวางกล่องบนโต๊ะตามเงื่อนไขที่กำหนดให้
12 | แล้วสัญลักษณ์ $B[n]$ จะหมายถึง ``จำนวนของกล่องทั้งหมดบนโต๊ะที่มีกล่องอื่น ๆ จำนวน $n$ ใบซ้อนอยู่ภายใน''
13 |
14 | \marginnote{%
15 | \centering
16 | \includegraphics[width=0.98\linewidth]{figures/quickfire_central_regional_nestbox.eps}\\
17 | รูปตัวอย่างการจัดวางกล่อง $B_0$
18 | }
19 |
20 | ยกตัวอย่างเช่น สมมติว่า $B_0$ คือการจัดวางกล่อง 5 ใบบนโต๊ะรูปแบบหนึ่ง ดังที่แสดงทางด้าน\ifpageodd{ขวา}{ซ้าย}มือนี้
21 | เราสามารถบอกได้ว่า $B_0[1] = \mathrm{2}$ (กล่องสีฟ้า), $B_0[2] = \mathrm{0}$,
22 | $B_0[3] = \mathrm{0}$ และ $B_0[4] = \mathrm{1}$ (กล่องสีแดง) ฯลฯ
23 | \end{quote}
24 |
25 | \noindent
26 | \textbf{\uline{โจทย์}}\; จงคำนวณว่าสำหรับการจัดวางกล่อง $B_1$ \uline{ในรูปแบบใด\,ๆ}
27 | ที่สอดคล้องกับเงื่อนไขว่า $B_1[1] = \mathrm{5}$,\, $B_1[2] = \mathrm{4}$,\, $B_1[3] = \mathrm{3}$,\,
28 | $B_1[4] = \mathrm{2}$ และ $B_1[5] = \mathrm{1}$ จะต้อง\uline{มีจำนวนกล่องรวม}ทั้งหมดอย่างน้อยกี่ใบ?
29 |
--------------------------------------------------------------------------------
/questions01_quickfire/central_regional_sortbetweensuper.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีฟังก์ชันหนึ่ง \lstinline{sort_between(L, p, q)}
4 | ซึ่งมีสเปกเหมือนกับคำถามที่แล้ว (ดู\autoref{q:quickfire_central_audition_sortbetweenintro})
5 |
6 | เราจะนำฟังก์ชัน \lstinline{sort_between} ดังกล่าวนี้มาใช้งานเพื่อเขียนฟังก์ชันใหม่ที่มีชื่อว่า
7 | \lstinline{slider_sort_between} ซึ่งมีกระบวนการทำงานดังต่อไปนี้
8 | \begin{lstlisting}
9 | function slider_sort_between(L, k):
10 | n := L.length()
11 | for i := 0 to n-k do:
12 | # <%\codecmt เรียงลำดับจำนวนที่ติดกัน%> k <%\codecmt จำนวนใน%> array L
13 | # <%\codecmt ตั้งแต่ตำแหน่งที่%> i <%\codecmt จนถึงตำแหน่งที่%> i-k+1
14 | sort_inplace(L, i, i+k-1)
15 | end
16 | end
17 | \end{lstlisting}
18 |
19 | สมมติว่าเรามี array \lstinline{L_1} ซึ่งประกอบไปด้วยจำนวนทั้งสิ้น 250 จำนวน\;
20 | เป้าหมายคือเราต้องการเรียงลำดับจำนวนทุกจำนวนภายใน array นี้ด้วยการเรียกใช้งานคำสั่ง
21 | \begin{center}
22 | \lstinline{L_1 := slider_sort_between(L_1, k=25)}
23 | \end{center}
24 | นี้\uline{ซ้ำ\;ๆ\;กัน}อย่างต่อเนื่อง จนกว่าจำนวนใน array \lstinline{L_1} จะเรียงลำดับทั้งหมด\;
25 | อยากทราบว่าเราจะต้องรันคำสั่งข้างต้นนี้\uline{อย่างน้อย}กี่รอบ
26 | จึงเพียงพอที่จะรับประกันว่าค่าทั้งหมดของ array \lstinline{L_1} เรียงลำดับจากน้อยไปมาก?
27 |
--------------------------------------------------------------------------------
/questions01_quickfire/north_audition_buffaloeasy.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ธนาคารกสิกรจัดประเพณีวิ่งควายที่จังหวัดชลบุรี มีควายร่วมเข้าแข่งขันวิ่งจำนวน 66 ตัว
4 | แต่ภายในงานมีลู่ให้ควายวิ่งได้แค่รอบละ 6 ตัวเท่านั้น
5 |
6 | หากธนาคารต้องการหาควายที่วิ่ง\uline{เร็วที่สุด} 1 ตัว
7 | เราจะต้องนำควายมาจัดวิ่งแข่งกันทั้งหมดอย่างน้อยกี่รอบ?\hrsp%
8 | \sidenote{%
9 | \textbf{เงื่อนไข}\; สมมติว่าควายวิ่งด้วยอัตราเร็วเท่าเดิมตลอดทุกรอบ
10 | และเราไม่สามารถใช้นาฬิกาจับเวลาได้ แต่สามารถเปรียบเทียบได้ว่าในการแข่งขันรอบหนึ่ง ควายตัวใดเข้าเส้นชัยก่อนหรือหลังได้
11 | }
12 |
--------------------------------------------------------------------------------
/questions01_quickfire/north_audition_negmaxsum.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณานิพจน์ที่เป็นโจทย์ดังต่อไปนี้แล้วตอบว่า จะเติมวงเล็บลงในนิพจน์นี้เพื่อ\uline{เปลี่ยนกลุ่มการบวกหรือการลบ}
4 | และให้ผลลัพธ์สุดท้ายมีค่ามากที่สุด จะได้ค่าเท่าใด?
5 | \[
6 | \mathrm{10 - 9 - 8 - 7 - 6 + 5 - 4 - 3 - 2 - 1}
7 | \]
8 |
--------------------------------------------------------------------------------
/questions01_quickfire/north_audition_validbfs.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จากกราฟที่กำหนดให้ดังรูปทางด้าน\ifpageodd{ขวา}{ซ้าย}มือ ข้อใดต่อไปนี้เป็นลำดับของ node ที่\uline{เป็นไปได้}จากการใช้อัลกอริทึม
4 | Breadth-first search เพื่อ traverse กราฟนี้
5 | \marginnote[-\baselineskip]{%
6 | \includegraphics[width=0.98\linewidth]{figures/quickfire_north_audition_validbfs.eps}
7 | }
8 |
9 | \begin{multicols}{5}
10 | \begin{enumerate}[label={$\Circle$}]
11 | \item \verb|ABCDEF|
12 | \item \verb|EABDFC|
13 | \item \verb|BEADCF|
14 | \item \verb|EABDCF|
15 | \item \verb|FAEDBC|
16 | \end{enumerate}
17 | \end{multicols}
18 |
--------------------------------------------------------------------------------
/questions01_quickfire/north_regional_buffalomedium.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ธนาคารกสิกรจัดประเพณีวิ่งควายที่จังหวัดชลบุรี มีควายร่วมเข้าแข่งขันวิ่งจำนวน 45 ตัว
4 | แต่ภายในงานมีลู่ให้ควายวิ่งได้แค่รอบละ 5 ตัวเท่านั้น
5 |
6 | หากธนาคารต้องการหาควายที่วิ่ง\uline{เร็วที่สุด}และ\uline{ช้าที่สุด} อย่างละ 1 ตัว เราจะต้องนำควายมาจัดวิ่งแข่งกันทั้งหมดอย่างน้อยกี่รอบ?
7 |
--------------------------------------------------------------------------------
/questions01_quickfire/north_regional_lockboxes.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | มีกล่องอยู่ 75 ใบ
4 | \begin{itemize}
5 | \item กล่องแต่ละใบถูกล็อกไว้ด้วยแม่กุญแจที่แตกต่างกันทั้งหมด
6 | \item กุญแจสำหรับแม่กุญแจแต่ละอัน ถูกบรรจุซ่อนอยู่ในกล่องใบอื่น ๆ (แปลว่ากุญแจที่จะเปิดกล่อง X จะอยู่ในกล่องอื่นซึ่งไม่ใช่ X)
7 | \item นอกจากนั้น แต่ละกล่องมีกุญแจอยู่ข้างในเพียงดอกเดียว
8 | \item การเปิดกล่องหนึ่งกล่องมีได้สองวิธีคือ 1.~ทำลายแม่กุญแจ หรือ 2.~ใช้กุญแจไข
9 | \end{itemize}
10 |
11 | หากเราต้องการเปิดกล่องทุกใบออกทั้งหมด โดยที่ทำลายแม่กุญแจให้น้อยที่สุด\;
12 | ในกรณีที่เลวร้ายที่สุดจะต้องทำลายแม่กุญแจอย่างน้อยกี่กล่องจึงจะเปิดกล่องได้ครบ 75 ใบ?
13 |
--------------------------------------------------------------------------------
/questions01_quickfire/north_regional_pigeoncard.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | สมมติว่ามีไพ่สำรับมาตรฐาน \uline{2 สำรับ} สำรับละ 52 ใบ รวมทั้งสิ้น 104 ใบ วางกองไว้รวมกันโดยไม่เรียงลำดับ
4 |
5 | \begin{itemize}
6 | \item \uline{ไพ่ 1 สำรับ} มีชุดตัวเลขทั้งสิ้น 13 ชุด (2, 3, 4, \ldots, 10, J, Q, K, A) ชุดละ 4 ใบ
7 | \item \uline{ไพ่ตอง} คือ ไพ่สามใบที่ชุดตัวเลขเหมือนกันเช่น 2, 2, 2 หรือ K, K, K
8 | \end{itemize}
9 |
10 | เราจะต้องหยิบไพ่ในกองดังกล่าวอย่างสุ่ม\uline{อย่างน้อยกี่ใบ} จึงจะรับประกันว่าในบรรดาไพ่ที่เราหยิบมาจะ\uline{มีไพ่ตองอย่างน้อย 1 ชุด}?
--------------------------------------------------------------------------------
/questions01_quickfire/north_regional_recursiondepth.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | คำถามเกี่ยวกับอัลกอริทึม Depth-first search (DFS)
4 |
5 | \smallskip\noindent
6 | \textbf{\uline{ตัวอย่าง}}\; พิจารณากราฟที่มีลักษณะเป็น grid ขนาด $\mathrm{3} \times \mathrm{3}$
7 | ดังที่แสดงทางด้าน%
8 | {\ifodd\thepage{ขวา}\else{ซ้าย}\fi}
9 | หากเราใช้อัลกอริทึม Depth-first search (DFS) กับกราฟนี้โดยเริ่มต้นจากโหนดใดก็ได้
10 | เราจะได้ Maximum recursion depth เท่ากับ 9 ดังที่แสดงด้วยเส้นสีฟ้า
11 |
12 | \begin{center}
13 | \bigskip
14 | \includegraphics[scale=0.6]{figures/quickfire_north_regional_recursiondepth_01.eps}
15 | \end{center}
16 | % \marginnote[-2\baselineskip]{%
17 | % \centering
18 | % \includegraphics[scale=0.6]{figures/quickfire_north_regional_recursiondepth_01.eps}\\
19 | % รูปประกอบกรณี\uline{ตัวอย่าง}
20 | % }
21 |
22 | \noindent
23 | \textbf{\uline{โจทย์}}\; จงหา Maximum recursion depth ที่เป็นไปได้
24 | หากเราสามารถใช้อัลกอริทึม Depth-first search จากโหนดใดก็ได้ในกราฟต่อไปนี้
25 | \begin{center}
26 | \bigskip
27 | \includegraphics[scale=0.6]{figures/quickfire_north_regional_recursiondepth_02.eps}
28 | \end{center}
29 |
--------------------------------------------------------------------------------
/questions01_quickfire/northeast_audition_betterthanlinear.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | สมมติว่ามี array ของจำนวนเต็มที่\uline{เรียงลำดับแล้ว} ขั้นตอนวิธีใดต่อไปนี้กระทำได้เร็วที่สุด?
4 |
5 | \begin{enumerate}[label={$\Circle$}]
6 | \item ค้นหาตัวเลข 42 ว่าอยู่ใน array หรือไม่
7 | \item นับว่ามีจำนวนตัวเลขที่แตกต่างกันภายใน array ทั้งหมดกี่ตัว
8 | \item หาค่าเฉลี่ยเลขคณิต (Arithmetic mean) ของตัวเลขทั้งหมดใน array
9 | \item นับว่ามีเลขคู่ทั้งหมดกี่ตัวใน array
10 | \item ทุกคำตอบข้างต้นใช้เวลาเป็น linear เท่ากันหมด ดังนั้นจึงใช้เวลาพอ ๆ กัน
11 | \end{enumerate}
12 |
--------------------------------------------------------------------------------
/questions01_quickfire/northeast_audition_counteven.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้ที่เขียนขึ้นเพื่อนับว่า
4 | มีจำนวนคู่กี่จำนวนในบรรดาจำนวนตั้งแต่จำนวนเต็ม \lstinline{m} จนถึงจำนวนเต็ม \lstinline{n} (สมมติว่า \verb|m ≤ n|)\;
5 | โปรแกรมนี้จะให้ผลลัพธ์ที่\uline{ถูกต้อง}ภายใต้เงื่อนไขใดของ input \uline{บ้าง}?
6 | \begin{lstlisting}
7 | function count_even(m, n):
8 | # m, n <%\codecmt คือจำนวนเต็มซึ่ง%> m <= n
9 | count := 0
10 | i := m
11 | while i <= n do:
12 | count := count + 1
13 | i := i + 2
14 | end
15 | return count
16 | end
17 | \end{lstlisting}
18 |
19 | \begin{multicols}{2}
20 | \begin{itemize}[label={$\square$}]
21 | \item กรณีที่ \verb|m| และ \verb|n| เป็นจำนวนคู่
22 | \item กรณีที่ \verb|m| เป็นจำนวนคี่ \verb|n| เป็นจำนวนคู่
23 | \item กรณีที่ \verb|m| เป็นจำนวนคู่ \verb|n| เป็นจำนวนคี่
24 | \item กรณีที่ \verb|m| และ \verb|n| เป็นจำนวนคี่
25 | \end{itemize}
26 | \end{multicols}
--------------------------------------------------------------------------------
/questions01_quickfire/northeast_audition_parenbalance.tex:
--------------------------------------------------------------------------------
1 | \question{\label{q:quickfire-northeast-audition-ec868bd3}}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้
4 | \begin{lstlisting}
5 | function mystery_<%\ref*{q:quickfire-northeast-audition-ec868bd3}%>(I):
6 | # I <%\codecmt คือ%> input character stream
7 | S := empty stack
8 | for each character c in stream I do:
9 | if c == '(' then:
10 | S.push('(')
11 | elseif c == ')' and S != empty then:
12 | S.pop()
13 | else:
14 | return "unbalanced"
15 | return "balanced"
16 | end
17 | \end{lstlisting}
18 |
19 | \medskip\noindent
20 | ค่า input ในข้อใดต่อไปนี้\uline{บ้าง}ที่ทำให้โปรแกรมข้างต้นให้ output เป็น \lstinline{"balanced"}?
21 |
22 | \begin{fullwidth}
23 | \begin{multicols}{4}
24 | \begin{itemize}[label={$\square$}]
25 | \item \lstinline{I = "()()()())"}
26 | \item \lstinline{I = "((()))"}
27 | \item \lstinline{I = ")()("}
28 | \item \lstinline{I = "())(()"}
29 | \item \lstinline{I = "()(()())"}
30 | \item \lstinline{I = "(())(())("}
31 | \item \lstinline{I = "(()))()"}
32 | \item[]
33 | \end{itemize}
34 | \end{multicols}
35 | \end{fullwidth}
--------------------------------------------------------------------------------
/questions01_quickfire/northeast_regional_fiboratio.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ให้พิจารณาลำดับจำนวน Fibonacci ที่มีความยาวเป็นอนันต์\;
4 | จงหาอัตราส่วนของ\uline{จำนวนเลขคู่}ต่อ\uline{จำนวนเลขคี่}ในลำดับจำนวนนี้
5 |
--------------------------------------------------------------------------------
/questions01_quickfire/northeast_regional_whatm.tex:
--------------------------------------------------------------------------------
1 | \question{\label{q:quickfire-northeast-regional-whatm}}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้
4 | \begin{lstlisting}
5 | function mystery_<%\ref*{q:quickfire-northeast-regional-whatm}%>(A[0...n-1]):
6 | # A <%\codecmt คือ%> 0-indexed array <%\codecmt ของจำนวนเต็ม%>
7 | n = A.length()
8 | result = 0
9 | for i := 0 to n-1 do:
10 | if A[i] < result then:
11 | result := A[i]
12 | end
13 | return result
14 | end
15 | \end{lstlisting}
16 |
17 | จงหาผลลัพธ์ของการรันโปรแกรม \lstinline{mystery_}%
18 | \texttt{\small\ref*{q:quickfire-northeast-regional-whatm}}%
19 | \lstinline{([9, 43, 214, 1, 5])}
20 |
--------------------------------------------------------------------------------
/questions01_quickfire/south_regional_clocktick.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ธนาคารกสิกรไทยสาขาหนึ่งเปิดให้บริการตั้งแต่เวลา 8:30 จนถึง 15:30 ของวันเดียวกัน\;
4 | อยากทราบว่าในช่วงเวลาดังกล่าวจะมีเหตุการณ์ที่เข็มสั้นและเข็มยาวของนาฬิกาทำมุม%
5 | \uline{ตั้งฉากกันพอดี}ทั้งหมดกี่ครั้ง?\hrsp%
6 | \sidenote{%
7 | \textbf{เงื่อนไข}\; กำหนดให้เข็มสั้นและเข็มยาวขยับอย่างต่อเนื่องตลอดเวลา
8 | }
--------------------------------------------------------------------------------
/questions01_quickfire/south_regional_negmaxsum.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงศึกษาตัวอย่างโจทย์ดังต่อไปนี้ แล้วจึงแก้โจทย์ในช่วงท้ายของคำถาม
4 |
5 | \smallskip\noindent
6 | \textbf{\uline{ตัวอย่าง}}\; จากนิพจน์ (expression) ทางคณิตศาสตร์ต่อไปนี้
7 | \[
8 | \mathrm{5 - 2 + 8 - 4 - 3}
9 | \]
10 |
11 | หากเราเติมวงเล็บในนิพจน์ข้างต้นกี่คู่ก็ได้เพื่อ\uline{เปลี่ยนกลุ่มการบวกหรือการลบ}เท่านั้น\hrsp%
12 | \sidenote{%
13 | \textbf{ยกตัวอย่าง} เช่น
14 | \begin{itemize}
15 | \item $\mathrm{5 - (2 + 8) - 4 - 3 = -12}$
16 | \item $\mathrm{5 - (2 + 8 - 4 - 3) = 2}$
17 | \item $\mathrm{5 - (2 + 8 - (4 - 3)) = -4}$
18 | \end{itemize}
19 | \textbf{หมายเหตุ}\; แต่\uline{ไม่อนุญาต}ให้มีการคูณเกิดขึ้นจากการเติมวงเล็บในนิพจน์ที่กำหนดให้ เช่น
20 | \begin{itemize}
21 | \item $\mathrm{5 - 2 + 8 (-4)(-3) = 99}$
22 | \end{itemize}
23 | }
24 | จะทำให้ผลลัพธ์สุดท้ายที่ได้ต่างออกไป\;
25 | แต่วิธีการเติมวงเล็บที่ทำให้ผลลัพธ์สุดท้ายที่ค่า\uline{มาก} \uline{ที่สุด}คือ
26 | \[
27 | \mathrm{5 - 2 + 8 - (4 - 3) = 10}
28 | \]
29 |
30 | \noindent
31 | \textbf{\uline{โจทย์}}\; จงพิจารณานิพจน์ที่เป็นโจทย์ดังต่อไปนี้แล้วตอบว่า
32 | จะเติมวงเล็บลงในนิพจน์นี้เพื่อเปลี่ยนกลุ่มการลบ
33 | และให้ผลลัพธ์สุดท้ายมีค่ามากที่สุด จะได้ค่าเท่าใด?
34 | \[
35 | \mathrm{0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10}
36 | \]
37 |
--------------------------------------------------------------------------------
/questions01_quickfire/south_regional_reverseshuffle.tex:
--------------------------------------------------------------------------------
1 | \question{\label{q:quickfire_south_regional_reverseshuffle}}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้
4 | \begin{lstlisting}
5 | function mystery_<%\ref*{q:quickfire_south_regional_reverseshuffle}%>(A[0...n-1])
6 | # A <%\codecmt คือ%> 0-indexed array
7 | n := A.length()
8 | for i := 0 to n-1
9 | for j := n downto i + 1
10 | swap values between A[i] and A[j]
11 | end
12 | end
13 | return A
14 | end
15 | \end{lstlisting}
16 |
17 | จงหา array \lstinline{A} ที่เมื่อป้อนเป็น input ให้แก่โปรแกรมข้างต้นแล้ว
18 | จะได้ output ออกมาเป็น array ที่มีค่า \lstinline{[1, 2, 3, 4]}
19 |
--------------------------------------------------------------------------------
/questions01_quickfire/south_regional_treeheight.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีต้นไม้ค้นหาแบบทวิภาค (Binary search tree) ที่\uline{ว่างเปล่า}อยู่ต้นหนึ่ง\;
4 | จากนั้นเรา insert ข้อมูลจำนวนเต็ม 9, 2, 3, 4, 18, 11, 20 เข้าไปในต้นไม้นี้ตามลำดับ
5 | โดยที่\uline{ไม่เกิด}กระบวนการ tree rebalancing ขึ้น
6 |
7 | จงหาความสูง (height) ของต้นไม้ผลลัพธ์\;
8 | (\textbf{หมายเหตุ:} กำหนดให้ Binary search tree ที่มี node เดียวมีความสูงเท่ากับ 0)
9 |
--------------------------------------------------------------------------------
/questions02_ponder/central_audition_biasedcoin.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีเหรียญบาทอยู่เหรียญหนึ่ง เมื่อโยนแต่ละครั้งแล้วจะให้ผลลัพธ์เป็นหัว (head)
4 | ด้วยความน่าจะเป็น 49\% และเป็นก้อย (tail) ด้วยความน่าจะเป็น 51\%
5 |
6 | เป้าหมายของเราคือ เราจะใช้เหรียญบาทดังกล่าวในการเขียนโปรแกรมเพื่อสุ่มตัวเลข 0 หรือ 1
7 | อย่างเที่ยงธรรมที่สุดเท่าที่เป็นไปได้ (นั่นคือโอกาสในการออกหัวหรือก้อยต้อง\uline{เท่ากัน}
8 | หรือ\uline{ใกล้เคียงกันให้มากที่สุด})
9 |
10 | โดยโปรแกรมดังกล่าวจะมี API ที่ต่อเข้าถึงการโยนเหรียญบาทข้างต้น ด้วยการเรียกใช้ฟังก์ชัน
11 | \lstinline{toss()} ซึ่งจะคืนค่าสตริง \lstinline{"head"} หรือ \lstinline{"tail"} เท่านั้น)
12 |
13 | จงเรียงลำดับความยุติธรรมของโปรแกรม A, B, C, D ต่อไปนี้ จากยุติธรรมมากที่สุดไปยังน้อยที่สุด
14 |
15 | \newpage
16 | \begin{fullwidth}
17 | \begin{itemize}[label={$\triangle$}]
18 | \item \textbf{โปรแกรม A}
19 | \begin{lstlisting}
20 | repeat until terminate
21 | count_heads := 0
22 | for i := 1 to 100 do:
23 | if toss() == "head" then count_heads := count_heads + 1
24 | end
25 | if count_heads < 49 then
26 | output 0 and terminate
27 | else if count_heads > 49
28 | output 1 and terminate
29 | end
30 | end
31 | \end{lstlisting}
32 | \item \textbf{โปรแกรม B}
33 | \begin{lstlisting}
34 | repeat until break
35 | result := toss()
36 | if result == "tail" then
37 | break # break from loop
38 | end
39 | end
40 | if toss() := "head" then
41 | output 0
42 | else
43 | output 1
44 | end
45 | terminate
46 | \end{lstlisting}
47 | \item \textbf{โปรแกรม C}
48 | \begin{lstlisting}
49 | repeat until terminate
50 | count_heads := 0
51 | if toss() == "head" then count_heads := count_heads + 1
52 | if toss() == "head" then count_heads := count_heads + 1
53 | if count_heads ≠ 1 then
54 | output count_heads/2 and terminate
55 | end
56 | end
57 | \end{lstlisting}
58 | \item \textbf{โปรแกรม D}
59 | \begin{lstlisting}
60 | repeat until terminate
61 | count_heads := 0
62 | if toss() == "head" then count_heads := count_heads + 1
63 | result := count_heads
64 | if toss() == "head" then count_heads := count_heads + 1
65 | if count_heads == 1 then
66 | output result and terminate
67 | end
68 | end
69 | \end{lstlisting}
70 | \end{itemize}
71 | \end{fullwidth}
--------------------------------------------------------------------------------
/questions02_ponder/central_audition_cloudupgrade.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | สมมติว่านายกสิกรมีโปรแกรมที่เขียนขึ้นมาเองอยู่โปรแกรมหนึ่ง เพื่อใช้ประมวลผลข้อมูลขนาดใหญ่มหาศาล
4 | ซึ่งโปรแกรมนี้อาจจะต้องใช้เวลาทำงาน\uline{ต่อเนื่อง}หลายชั่วโมง
5 | และ\uline{ไม่อาจคาดเดาได้}ว่าโปรแกรมนี้จะใช้เวลาประมวลผลกี่ชั่วโมง (จนกว่าโปรแกรมจะรันเสร็จสิ้นเท่านั้น)
6 |
7 | นายกสิกรตัดสินใจใช้บริการคลาวด์แห่งหนึ่งเพื่อรันโปรแกรมของตัวเอง
8 | โดยคลาวด์ดังกล่าวมีนโยบายการคิดค่าบริการดังนี้
9 | \marginnote{
10 | \textbf{ตัวอย่าง}\; ลองพิจารณาสถานการณ์สมมติดังต่อไปนี้
11 | \begin{itemize}
12 | \item
13 | สมมติว่านายกสิกรเริ่มนำโปรแกรมนี้ไปรันในคลาวด์นี้แบบคิดค่าเช่ารายชั่วโมง \:\adforn{62}\:
14 | เมื่อเวลาผ่านไป 4 ชั่วโมงพบว่าโปรแกรมนี้ยังประมวลผลไม่เสร็จ
15 | นายกสิกร จึงตัดสินใจเลือก upgrade เป็น Flat rate \:\adforn{62}\:
16 | แต่จากนั้นเมื่อเวลาผ่านไปอีก 2 ชั่วโมงโปรแกรมจึงรันเสร็จสิ้น
17 |
18 | จึงเท่ากับว่าค่าใช้จ่ายที่ถูกที่สุดที่เป็นไปได้ในทางทฤษฎี (Optimal cost) ในกรณีนี้คือ 7,200 บาท
19 | แต่นายกสิกรต้องเสียเงินจริง (Actual cost) ไปถึง 14,800 บาท
20 | ซึ่งคิดเป็น 2.056 เท่าของ Optimal cost
21 |
22 | \item
23 | ในอีกเหตุการณ์หนึ่ง สมมติว่านายกสิกรรันโปรแกรมดังกล่าวจนครบ 6 ชั่วโมง
24 | พบว่ายังประมวลผลไม่เสร็จสิ้น จึงลองเสี่ยง upgrade เป็น Flat rate ดู \:\adforn{62}\:
25 | แต่สุดท้ายแล้วโปรแกรมนี้ใช้เวลาถึง 20 ชั่วโมงในการรันจนเสร็จสิ้น
26 |
27 | จึงเท่ากับว่านายกสิกรเสีย Actual cost ไป 17,200 บาท
28 | ซึ่งคิดเป็น 1.72 เท่าของ Optimal cost ที่เกิดจากการเหมาจ่ายตั้งแต่แรกที่ 10,000 บาท
29 | \end{itemize}
30 | }
31 | \begin{itemize}
32 | \item หากเช่าเป็นชั่วโมง คิดชั่วโมงละ 1,200 บาท
33 | \item ระหว่างที่โปรแกรมของนายกสิกรกำลังรันอยู่และค่าใช้บริการถูกคิดเป็นค่าเช่ารายชั่วโมงอยู่นั้น\;
34 | นายกสิกรสามารถเลือก upgrade บริการคลาวด์ให้คิดค่าบริการแบบ Flat rate เมื่อใดก็ได้
35 | โดยคิดเหมาจ่ายในราคา 10,000 บาท และจะ\uline{ไม่ได้ค่าเช่ารายชั่วโมงก่อนหน้า}
36 | \uline{นั้นคืน} (กล่าวคือ upgrade เร็วย่อมคุ้มค่ากว่า upgrade ช้า)
37 | \end{itemize}
38 |
39 | \noindent
40 | เมื่อพิจารณาตัวอย่างสถานการณ์ที่ปรากฏทางด้านข้างแล้ว สังเกตว่าปัญหามีอยู่สองส่วนคือ
41 | \begin{enumerate}
42 | \item นายกสิกร ไม่สามารถคาดเดาระยะเวลาที่ Program จะใช้ประมวลผลได้ล่วงหน้า
43 | \item ถ้าเรา upgrade เร็วหรือช้าเกินไป ค่าใช้จ่ายในกรณี worst-case
44 | อาจจะสูงเกินกว่าที่ควรจะเป็น อันเนื่องมาจากสาเหตุข้อแรก
45 | \end{enumerate}
46 |
47 | นายกสิกรต้องการต้องการคิดกลยุทธ (Strategy) เพื่อวางแผนใช้บริการคลาวด์ดังกล่าว
48 | ให้คุ้มค่าทุกบาททุกสตางค์มากที่สุดเท่าที่เป็นไปได้ แม้ว่านายกสิกรจะคาดเดาจำนวนชั่วโมงที่โปรแกรมจะใช้รันไม่ได้เลย\;
49 | กล่าวคือค่าใช้จ่ายจริง (Actual cost) จะต้องมีปริมาณน้อยที่สุดเมื่อ\uline{เทียบอัตราส่วน}%
50 | กับค่าใช้จ่ายที่ถูกที่สุดที่เป็นไปได้ (Optimal cost)
51 |
52 | อยากทราบว่านายกสิกรควรวางแผนเช่าหรือ upgrade อย่างไรจึงจะ
53 | minimize ค่าของ $\frac{\text{Actual cost}}{\text{Optimal cost}}$
54 | ให้เหลือน้อยที่สุด ไม่ว่าโปรแกรมของนายกสิกรจะใช้เวลารันกี่ชั่วโมงก็ตาม?
55 | \begin{enumerate}[label={$\Circle$}]
56 | \item นายกสิกรควร upgrade เป็นการคิดค่าบริการแบบ Flat rate ทันทีโดยไม่เสียค่าเช่ารายชั่วโมง
57 | (แปลว่านายกสิกรจะเสียเงิน 10,000 บาทเสมอ ไม่ว่าโปรแกรมจะรันกี่ชั่วโมง)
58 | \item นายกสิกรควรตัดสินใจเสียค่าเช่ารายชั่วโมงตลอดไป ไม่ควร upgrade เลย
59 | \item[\llap{*}$\Circle$] นายกสิกรควรเสียค่าเช่ารายชั่วโมงเป็นเวลาไม่เกิน $h$ ชั่วโมง
60 | แล้วจึง upgrade หากโปรแกรมยังรันไม่เสร็จเมื่อเวลาผ่านไป $h$ ชั่วโมงพอดี \\
61 | (\textbf{หมายเหตุ:} หากเลือกตัวเลือกนี้ กรุณาระบุจำนวนเต็ม $h$ ดังกล่าวด้วย)
62 | \end{enumerate}
63 |
--------------------------------------------------------------------------------
/questions02_ponder/central_audition_infinitepath.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณากราฟที่กำหนดให้ต่อไปนี้
4 |
5 | \begin{center}
6 | \includegraphics[]{figures/ponder_central_audition_infinitepath.eps}
7 | \end{center}
8 |
9 | ให้พิจารณากราฟที่กำหนดให้ เราจะเขียนโปรแกรมเพื่อเดิน (traverse) บนกราฟดังกล่าว โดยมีเงื่อนไขดังนี้
10 | \begin{enumerate}
11 | \item เราจะเริ่มต้นการเดินจากโหนด A
12 | \item จากโหนดหนึ่ง ๆ เราจะเดินไปยังโหนดถัดไปเฉพาะโหนดที่มีลูกศรชี้ไปหาเสมอ
13 |
14 | หากมีลูกศรชี้ไปยังโหนดอื่น ๆ มากกว่า 1 โหนด ให้เลือกเดินไปโหนดถัดไป\uline{โหนดใดก็ได้}
15 | \uline{จากตัวเลือกนั้น ๆ} (เช่น จากโหนด B เราสามารถเดินไปยังโหนด A หรือ E โหนดใดก็ได้)
16 | \item เราจะเดินบนกราฟนี้ไปเรื่อย ๆ ไม่มีหยุดอยู่กับที่ (เสมือนว่าโปรแกรมของเรามี infinite loop)
17 | \end{enumerate}
18 |
19 | \noindent
20 | จากการเดินบนกราฟอย่างไม่สิ้นสุดตามคำอธิบายข้างต้น ข้อใดต่อไปนี้ถูกต้องบ้าง?
21 |
22 | \begin{itemize}[label={$\square$}]
23 | \item \textbf{ประพจน์ P:} รับประกันว่าในการเดินดังกล่าว ``เราจะเดินพบโหนด A อนันต์ครั้ง''
24 | หรือไม่เช่นนั้น ``เราจะเดินพบโหนด D อนันต์ครั้ง''
25 | \item \textbf{ประพจน์ Q:} รับประกันว่าในการเดินดังกล่าว ``เราจะเดินพบโหนด B อนันต์ครั้ง''
26 | หรือไม่เช่นนั้น ``เราจะเดินพบโหนด E อนันต์ครั้ง''
27 | \item \textbf{ประพจน์ R:} รับประกันว่าในการเดินดังกล่าว ``เราจะเดินพบโหนด C อนันต์ครั้ง''
28 | หรือไม่เช่นนั้น ``เราจะเดินพบโหนด F อนันต์ครั้ง''
29 | \end{itemize}
30 |
--------------------------------------------------------------------------------
/questions02_ponder/central_audition_primepartition.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | เรากำหนดนิยามของ ``จำนวนรูปงาม'' ดังนี้
4 |
5 | \begin{quote}
6 | \textbf{\uline{นิยาม}} ``จำนวนรูปงาม'' คือจำนวนเต็มที่สามารถเขียนในรูปของ
7 | string concatenation ของสตริงย่อย ๆ อย่างน้อยหนึ่งตสตริงได้
8 | และสตริงย่อยแต่ละตัวจะต้องเป็นจำนวนเฉพาะที่\uline{ไม่ขึ้นต้น}\\
9 | ด้วย \verb|0| เท่านั้น
10 |
11 | ยกตัวอย่างเช่น
12 | \begin{itemize}
13 | \item จำนวนเฉพาะทุกตัว ({\hrsp}ได้แก่ \verb|"2"|, \verb|"3"|, \verb|"5"|, \verb|"7"|,
14 | \verb|"11"|, \verb|"13"|, \ldots\hrsp) \\ เป็นจำนวนรูปงามโดยปริยาย
15 | \item จำนวน \verb|"1012"| เป็นจำนวนรูปงาม เพราะอยู่ในรูปของ \verb|"101" + "2"| \\
16 | ซึ่งแต่ละพจน์เป็นจำนวนเฉพาะ
17 | \item จำนวน \verb|"5932"| เป็นจำนวนรูปงาม เพราะอยู่ในรูปของ \verb|"59" + "3" + "2"| \\
18 | ซึ่งแต่ละพจน์เป็นจำนวนเฉพาะ
19 | \item จำนวน \verb|"7352"| เป็นจำนวนรูปงาม เพราะอยู่ในรูปของ \verb|"7" + "3" + "5" + "2"| \\
20 | ซึ่งแต่ละพจน์เป็นจำนวนเฉพาะ
21 | \item จำนวน \verb|"1149"| ไม่เป็นจำนวนรูปงามเพราะไม่ว่าจะแบ่งสตริงดังกล่าวอย่างไร
22 | ก็ไม่สามารถเขียนในรูปของ string concatenation ของจำนวนเฉพาะได้
23 | \item จำนวน \verb|"7007"| ไม่เป็นจำนวนรูปงามเพราะไม่ว่าจะแบ่งสตริงดังกล่าวอย่างไร
24 | ก็ไม่สามารถเขียนในรูปของ string concatenation ของจำนวนเฉพาะที่ไม่ขึ้นต้นด้วย 0 ได้
25 | \end{itemize}
26 | \end{quote}
27 |
28 | \noindent
29 | \textbf{\uline{โจทย์}} จงหาว่าจำนวนเต็ม 5 หลักที่จัดว่าเป็น ``จำนวนรูปงาม'' มีทั้งหมดกี่จำนวน?
30 |
--------------------------------------------------------------------------------
/questions02_ponder/central_audition_timecomplexhard.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้
4 | \begin{lstlisting}
5 | function foo(A):
6 | n := A.length()
7 | bar(A, 0, n-1)
8 | end
9 |
10 | function bar(A, lo, hi):
11 | if hi - lo ≤ 31 then:
12 | return spin(A, lo, hi)
13 | end
14 | mid := select an integer strictly between <%\SuppressNumber%>
15 | lo and hi uniformly at random <%\ReactivateNumber%>
16 | return bar(A, lo, mid) + bar(A, mid, hi)
17 | end
18 |
19 | function spin(A, lo, hi):
20 | count := 0
21 | for i := lo to hi-1 do:
22 | for j := i + 1 to hi do:
23 | if A[i] > A[j] then count := count + 1
24 | end
25 | end
26 | return count
27 | end
28 | \end{lstlisting}
29 |
30 | หากกำหนดให้ฟังก์ชัน \lstinline{foo(A)} ในโปรแกรมข้างต้นมี input argument
31 | คือ array \lstinline{A} ของจำนวนเต็มที่มีความยาว \lstinline{n} ตัวแล้ว
32 | จงวิเคราะห์เพื่อคํานวณหา Worst-case time complexity และ Average-case time complexity
33 | ของฟังก์ชัน \lstinline{foo} ในรูปของ \lstinline{n}
34 |
--------------------------------------------------------------------------------
/questions02_ponder/central_regional_candy.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงศึกษาตัวอย่างโจทย์ต่อไปนี้ แล้วจึงแก้โจทย์ในช่วงท้ายของคำถาม
4 |
5 | \smallskip\noindent
6 | \textbf{\uline{ตัวอย่าง}}\; สมมติว่ามีลูกอมยี่ห้อหนึ่ง ถูกบรรจุขายเป็นแพ็คถุง 2 ขนาด คือแบบถุงละ 3 ลูก หรือ 5 ลูก สังเกตว่า
7 |
8 | \begin{itemize}[before*=\small]
9 | \item เราสามารถซื้อลูกอมให้มีลูกอม\uline{เป็นจำนวนรวม} 8 ลูกได้
10 | (คือซื้อทั้งสองแบบ แบบละ 1 ถุง แล้วนำลูกอมมาเทรวมกัน)
11 | \item แต่เรา\uline{ไม่มี}วิธีที่สามารถซื้อลูกอมเป็นจำนวนรวม 7 ลูกพอดีได้เลย
12 | \end{itemize}
13 |
14 | \noindent
15 | \textbf{\uline{โจทย์}}\; สมมติว่ามีลูกอมอีกยี่ห้อหนึ่ง ถูกบรรจุขายเป็นแพ็ค 3 ขนาด
16 | คือแบบถุงละ 6 ลูก หรือ 15 ลูก หรือ 40 ลูก ตามลำดับ\;
17 | แล้วจำนวนลูกอมที่มากที่สุดที่เรา\uline{ไม่สามารถ}หาวิธีซื้อให้พอดีจากการผสมแพ็คลูกอมทั้ง 3 แบบนี้ มีจำนวนลูกอมเท่าใด?
18 |
--------------------------------------------------------------------------------
/questions02_ponder/central_regional_comptreeesay.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มี input ทั้งสิ้น 1 จำนวน ได้แก่จำนวนจริง $x$
4 |
5 | จาก input ข้างต้นนี้ เป้าหมายคือการคำนวณค่าของ $x^n$ โดยที่ $n$ เป็นจำนวนเต็มบวก
6 | โดยใช้ operation การคูณเป็น\uline{จำนวนครั้งน้อยที่สุด} ภายใต้เงื่อนไขดังต่อไปนี้
7 | \begin{itemize}
8 | \item อนุญาตให้ใช้เฉพาะ operation การคูณ
9 | \item อนุญาตให้นำผลคูณที่เกิดขึ้นก่อนหน้านั้น\uline{ระหว่างการคำนวณ}
10 | มาใช้เป็นตัวตั้งหรือตัวคูณของการคูณครั้งถัดไปได้\hrsp%
11 | \sidenote[][-\baselineskip]{%
12 | \textbf{ยกตัวอย่าง}\; สมมติว่าเราต้องการคำนวณ $x^n$ ในกรณีที่ $n = \mathrm{6}$
13 | เราจะใช้การคูณ\uline{น้อยที่สุด}เพียง 3 ครั้งเท่านั้น เขียนเป็นขั้นตอนวิธีได้ดังนี้
14 | \begin{flushleft}
15 | \quad\lstinline{r_1 := x * x # => x^2} \\
16 | \quad\lstinline{r_2 := r_1 * r_1 # => x^4} \\
17 | \quad\lstinline{r_3 := r_1 * r_2 # => x^6}
18 | \end{flushleft}
19 |
20 | สังเกตว่า จากข้อมูล $x$ ที่เราทราบ เราจะคำนวณหาค่าของ $x^\mathrm{2}$, $x^\mathrm{4}$
21 | และ $x^\mathrm{6}$ ตามลำดับ\;
22 | นอกเหนือจากวิธีนี้ ยังมีวิธีอื่นอีก เช่น การคำนวณหา $x^\mathrm{2}$, $x^\mathrm{3}$
23 | และ $x^\mathrm{6}$ ตามลำดับ
24 | }
25 | (หมายความว่า เรามีการ\uline{จดบันทึก}ผลการคูณที่เกิดขึ้นทั้งหมด
26 | คล้ายกับ history tape ในเครื่องคิดเลขของนักบัญชี)
27 | \end{itemize}
28 |
29 | \noindent
30 | \textbf{\uline{โจทย์}} การคำนวณหาค่าของ $x^n$ ในกรณีที่ $n=\mathrm{125}$
31 | (นั่นคือให้คำนวณค่าของ $x^\mathrm{125}$) จะต้องใช้ operation การคูณเป็นจำนวน\uline{น้อยที่สุด}กี่ครั้ง?
32 | และการคูณในแต่ละขั้นนั้นจะคำนวณ $x^{???}$ อะไรบ้าง\uline{ตามลำดับ}?\; (ให้ตอบมา 1 วิธี)
33 |
--------------------------------------------------------------------------------
/questions02_ponder/central_regional_cryptarithmetic.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ให้พิจารณาสมการดทางด้าน\ifpageodd{ขวา}{ซ้าย}ต่อไปนี้ โดยมีเงื่อนไขว่า
4 | \marginnote[\baselineskip]{
5 | \begin{center}
6 | \includegraphics[width=0.85\linewidth]{figures/ponder_central_regional_cryptarithmetic.eps}
7 | \end{center}
8 | }
9 |
10 | \begin{itemize}
11 | \item แต่จะพจน์ (term) ของการบวกคือจำนวนเต็มที่เลขโดดแต่ละตัวถูกเขียนแทนด้วยอักขระภาษาอังกฤษ 1 ตัว
12 | \item อักขระตัวเดียวกันแทนเลขโดดเดียวกัน อักขระที่ต่างกันแทนเลขโดดที่ไม่ซ้ำกัน
13 | \item ไม่มีพจน์ใดที่อักขระตัวแรกแทนเลขโดด 0
14 | \end{itemize}
15 |
16 | \noindent
17 | อยากทราบว่าคำว่า \textbf{\ltspc BRACKET} แทนจำนวนใด?
18 |
--------------------------------------------------------------------------------
/questions02_ponder/central_regional_intbipartite.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีจำนวนเต็ม ได้แก่ 1, 2, 3, \ldots, 12
4 |
5 | ให้แบ่งกลุ่มของจำนวนเต็มดังกล่าวออกเป็น 2 กลุ่ม\; โดยแต่ละกลุ่มจะต้องมีจำนวนเต็มอย่างน้อย 1 จำนวน\;
6 | จากนั้นให้หาผลคูณของจำนวนในแต่ละกลุ่ม
7 |
8 | \medskip\noindent
9 | \textbf{\uline{โจทย์}} อยากทราบว่า\hrsp\uline{ผลต่าง}ของ\uline{ผลคูณ}จากทั้งสองกลุ่ม
10 | มีค่า\uline{น้อยที่สุด}เท่าใด?
11 |
--------------------------------------------------------------------------------
/questions02_ponder/central_regional_pizzapaint.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | พิซซ่าถาดหนึ่งถูกตัดแบ่งด้วยรัศมีออกเป็นพิซซ่าชิ้นย่อย ๆ 8 ชิ้นที่มาขนาดเท่า ๆ กัน\;
4 | ต่อจากนั้นพิซซ่า\uline{แต่ละชิ้น}ย่อยทุกชิ้นจะถูกทาด้วยซอส 1 ใน 3 ชนิด (ได้แก่ ซอสขาว ซอสแดง หรือซอสน้ำตาล)
5 |
6 | \medskip\noindent
7 | \textbf{\uline{นิยาม}} พิซซ่าสองถาดจะมีหน้าตา\uline{แบบเดียวกัน}
8 | ก็ต่อเมื่อ หากสามารถหมุนถาดพิซซ่าถาดหนึ่งให้มีหน้าตาเหมือนกันพิซซ่าอีกถาดหนึ่งได้
9 |
10 | \begin{fullwidth}
11 | \begin{multicols}{2}
12 | \begin{center}
13 | \includegraphics[width=0.85\linewidth]{figures/ponder_central_regional_pizzapaint_01.eps}\\
14 | ตัวอย่างของพิซซ่าที่หน้าตา\uline{เหมือนกัน}
15 |
16 | \includegraphics[width=0.85\linewidth]{figures/ponder_central_regional_pizzapaint_02.eps}\\
17 | ตัวอย่างของพิซซ่าที่หน้าตา\uline{แตกต่างกันทั้งหมด}
18 | \end{center}
19 |
20 | \end{multicols}
21 | \end{fullwidth}
22 |
23 | \medskip\noindent
24 | \textbf{\uline{โจทย์}} อยากทราบว่าเราจะได้ถาดพิซซ่าที่หน้าตามีการทาซอสออกมาแตกต่างกันทั้งหมดกี่แบบ?
25 |
26 |
--------------------------------------------------------------------------------
/questions02_ponder/national_3tap.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ชุดของจำนวนชุดหนึ่งจะมี 3-term arithmetic progression (\textbf{3TAP})
4 | หากมีจำนวน 3 จำนวนในชุดดังกล่าวที่เรียงเป็นลำดับเลขคณิต\; ยกตัวอย่างเช่น
5 | \begin{itemize}[before*=\small]
6 | \item ในชุดของจำนวน 1, 2, 4, 5, 7, 11 จะมี \textbf{3TAP} เนื่องจากมีจำนวน 3 จำนวน ซึ่งได้แก่ 1, 4, 7 เป็นลำดับเลขคณิต
7 | \item ในชุดของจำนวน 1, 2, 5, 7, 10, 11 นั้นไม่มี \textbf{3TAP} อยู่เลย
8 | \end{itemize}
9 |
10 | \noindent
11 | \textbf{\uline{โจทย์}} จงหาชุดของจำนวนเต็มจากจำนวนเต็มตั้งแต่ 1 ไปจนถึง 30 ที่มีจำนวนสมาชิกมากที่สุด
12 | และไม่มี \textbf{3TAP} อยู่เลย
13 |
--------------------------------------------------------------------------------
/questions02_ponder/national_classroom.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ในโรงเรียนประถมศึกษาแห่งหนึ่ง มีห้องเรียนชั้น ป.1 อยู่ 2 ห้อง ได้แก่ห้องทานตะวัน และห้องกุหลาบ
4 |
5 | เด็กชาย K เรียนอยู่ในห้องทานตะวัน และมีเพื่อนสนิทอยู่ 8 คน ได้แก่ A, B, C, D, E, F, G และ H\;\;
6 | บางคนเรียนอยู่ห้องทานตะวันเช่นเดียวกับเด็กชาย K \;
7 | ส่วนบางคนเรียนอยู่ห้องกุหลาบ คนละห้องกับเด็กชาย K
8 |
9 | ต่อไปนี้คำบอกกล่าวของครูใหญ่ทั้งสิ้น 14 ประโยค
10 |
11 | \begin{multicols}{2}
12 | \begin{enumerate}
13 | \item A กับ B เรียนอยู่คนละห้องกัน
14 | \item B กับ C เรียนอยู่คนละห้องกัน
15 | \item C กับ D เรียนอยู่คนละห้องกัน
16 | \item D กับ E เรียนอยู่คนละห้องกัน
17 | \item E กับ A เรียนอยู่คนละห้องกัน
18 | \item A กับ F เรียนอยู่คนละห้องกัน
19 | \item F กับ G เรียนอยู่คนละห้องกัน
20 | \item G กับ H เรียนอยู่คนละห้องกัน
21 | \item H กับ D เรียนอยู่คนละห้องกัน
22 | \item D กับ B เรียนอยู่คนละห้องกัน
23 | \item B กับ E เรียนอยู่คนละห้องกัน
24 | \item E กับ C เรียนอยู่คนละห้องกัน
25 | \item C กับ K เรียนอยู่คนละห้องกัน
26 | \item K กับ G เรียนอยู่คนละห้องกัน
27 | \end{enumerate}
28 | \end{multicols}
29 |
30 | ในบรรดา 14 ประโยคข้างต้น มี \uline{2 ประโยคที่ไม่เป็นความจริง}
31 | จงพิจารณาข้อมูลข้างต้นแล้วตอบคำถามต่อไปนี้
32 | \begin{itemize}
33 | \item ประโยคใดเป็นเท็จบ้าง?
34 | \item ใครเรียนอยู่ห้องทานตะวันเช่นเดียวกับเด็กชาย K บ้าง?
35 | \end{itemize}
36 |
--------------------------------------------------------------------------------
/questions02_ponder/national_contiguousprimes.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงคำนวณหาลำดับของจำนวนเฉพาะที่เรียงอยู่ติดกันที่ยาวที่สุด
4 | ที่มีผลรวมเท่ากับ 1 ล้าน (1,000,000) พอดี
5 | \begin{enumerate}
6 | \item ลำดับดังกล่าวมี\uline{ความยาวเท่าใด}?
7 | \item จำนวนเฉพาะ\uline{ตัวแรก}และ\uline{ตัวสุดท้าย}ของลำดับดังกล่าวคือจำนวนใด?
8 | \end{enumerate}
9 |
--------------------------------------------------------------------------------
/questions02_ponder/national_foodchain.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณาระบบการถ่ายเทพลังงานในระบบห่วงโซ่อาหารของสัตว์กลุ่มหนึ่ง
4 | โดยที่สัตว์ทุกตัวในกลุ่มนี้มีโอกาสเป็นทั้งผู้ล่าและเหยื่อกับสัตว์ตัวอื่น ๆ ได้ทุกตัว
5 | \begin{itemize}
6 | \item กำหนดให้สัตว์ทุกตัวมี\uline{พลังงานสะสมเริ่มต้น}ในร่างกาย 1,000,000 KCal
7 | \item เมื่อเกิดการล่าเหยื่อขึ้น หากสัตว์ A จับสัตว์ B เป็นอาหารแล้วพบว่า B จะเสียชีวิตไป
8 | และ A จะได้รับถ่ายทอดพลังงานสะสม\uline{ครึ่งหนึ่ง}จาก B\hrsp%
9 | \sidenote{%
10 | \textbf{หมายเหตุ}\; เราสมมติว่าสัตว์แต่ละตัวจะไม่เสียพลังงานใด ๆ กับกิจกรรมอื่น ๆ เลย
11 | พลังงานจะหายไปจากระบบจากการที่เหยื่อถูกบริโภคเท่านั้น
12 | }
13 | \item สัตว์ทุกตัวในระบบจะจับเหยื่อตัวอื่น ๆ เป็นอาหารได้ไม่เกิน 3 ตัว
14 | \end{itemize}
15 |
16 | หากในตอนแรกมีสัตว์ในระบบนิเวศนี้ทั้งสิ้น 1,000 ตัว แล้วจึงเกิดการล่ากันเองขึ้นจนเหลือสัตว์ที่อยู่รอดตัวเดียว
17 | สัตว์ตัวดังกล่าวนี้จะมีพลังงานสะสมตอนท้าย\uline{อย่างน้อยที่สุด}และ
18 | \uline{อย่างมากที่สุด}กี่ KCal? ({\hrsp}ให้ตอบเป็นจำนวนเต็มโดย\uline{ปัดเศษทิ้ง}{\hrsp})
19 |
--------------------------------------------------------------------------------
/questions02_ponder/national_fourbyfour.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงเติมจำนวนเต็ม 1 ถึง 16 ลงในตารางขนาด $\mathrm{4} \times \mathrm{4}$
4 | มาอย่างน้อย 1 วิธีซึ่งสอดคล้องกับเงื่อนไขดังต่อไปนี้
5 | \marginnote[\baselineskip]{
6 | \centering
7 | \includegraphics[width=0.7\linewidth]{figures/ponder_national_fourbyfour.eps}
8 | }
9 |
10 | \begin{itemize}
11 | \item จำนวนใน\uline{แต่ละช่อง}ต้อง\uline{ไม่ซ้ำกัน}
12 | \item จำนวนใน\uline{แต่ละแถว} จะต้องเรียงลำดับจากน้อยไปมาก จาก\uline{ซ้ายไปขวา}
13 | \item จำนวนใน\uline{แต่ละคอลัมน์} จะต้องเรียงลำดับจากน้อยไปมาก จาก\uline{บนลงล่าง}
14 | \item สำหรับทุก $k \in \{\mathrm{1, 2, 3, 4}\}$\; ผลรวมของจำนวนในแถวที่ $k$ (นับจากบน) จะต้อง\uline{เท่ากับ}
15 | ผลรวมของจำนวนในคอลัมน์ที่ $k$ (นับจากซ้าย)
16 | \end{itemize}
17 |
--------------------------------------------------------------------------------
/questions02_ponder/national_greedytsp.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ปัญหา \textbf{Traveling salesperson problem} (TSP) คือปัญหากราฟที่มีเป้าหมายเพื่อค้นหาเส้นทางจากโหนดหนึ่ง ๆ
4 | ไปเยือนโหนดอื่น ๆ ทุกโหนด ก่อนกลับมายังโหนดเริ่มต้น โดยใช้ระยะทางรวมน้อยที่สุด
5 |
6 | สำหรับโจทย์ข้อนี้ให้พิจาณา Greedy algorithm เพื่อแก้ปัญหา TSP ข้างต้น ซึ่งมีขั้นตอนวิธีดังนี้\hrsp%
7 | \sidenote[][-\baselineskip]{%
8 | อัลกอริทึมนี้มีความเป็น non-deterministic
9 | เนื่องจากอัลกอริทึมมีการตัดสินใจแบบ arbitrary ได้เมื่อมีตัวเลือกปรากฏขึ้น ซึ่งมีผลทำให้ได้คำตอบที่แตกต่างออกไป
10 |
11 | ขั้นตอนของอัลกอริทึมดังกล่าวที่มีความเป็น non-deterministic จะมีเครื่องหมายดอกจันกำกับ
12 | }
13 | \begin{enumerate}
14 | \item เริ่มต้นจาก\uline{โหนดใดก็ได้}*
15 | \item \label{item:ponder_national_greedytsp_anynearest}
16 | จากโหนดปัจจุบัน ให้เลือกไปเยือนโหนดถัดไปที่อยู่ใกล้ที่สุดที่ยังไม่เคยเดินทางไปเยือน \\
17 | \textbf{หมายเหตุ:} หากมีหลายโหนดที่สอดคล้องกับเงื่อนไขข้างต้น ให้เลือกไปเยือน\uline{โหนดใดก็ได้}
18 | ในบรรดาโหนดเหล่านั้น*
19 | \item เมื่อกระทำตามข้อ \ref*{item:ponder_national_greedytsp_anynearest} จนเยือนครบทุกโหนดแล้ว
20 | ให้เดินกลับไปยังโหนดที่เป็นจุดเริ่มต้น
21 | \end{enumerate}
22 |
23 | อย่างไรก็ดี Greedy algorithm นี้\uline{ไม่รับประกัน}ว่าจะให้คำตอบที่ดีที่สุด (หรือ optimal solution) เสมอไป\;
24 | โจทย์ข้อนี้เราจะพิจารณา\uline{หาตัวอย่างค้าน}ที่ Greedy algorithm ข้างต้นให้ผลลัพธ์ที่แย่มากเป็นพิเศษ
25 |
26 | \marginnote{%
27 | \begin{center}
28 | \includegraphics[scale=0.75]{figures/ponder_national_greedytsp_02.eps} \\
29 | ({\hrsp}a{\hrsp})
30 |
31 | \vspace{2\baselineskip}
32 | \includegraphics[scale=0.75]{figures/ponder_national_greedytsp_03.eps} \\
33 | ({\hrsp}b{\hrsp})
34 |
35 | \vspace{2\baselineskip}
36 | \includegraphics[scale=0.75]{figures/ponder_national_greedytsp_04.eps} \\
37 | ({\hrsp}c{\hrsp})
38 | \end{center}
39 | }
40 | \begin{center}
41 | \medskip
42 | \includegraphics[]{figures/ponder_national_greedytsp_01.eps}
43 | \end{center}
44 |
45 | \noindent
46 | \textbf{\uline{เคสตัวอย่าง}} ให้พิจารณากราฟข้างต้น ซึ่งประกอบด้วยจุดบน Euclidean space
47 | ที่เรียงเป็นตารางสี่เหลี่ยมผืนผ้า 3 แถว แถวละ 4 จุด\; นอกจากนั้นแต่ละแถวและแต่ละคอลัมน์ห่างกัน 1 หน่วย
48 |
49 | \begin{itemize}
50 | \item หากเราโชคดีหน่อย Greedy algorithm อาจจะค้นพบเส้นทาง ({\hrsp}a{\hrsp})
51 | ที่แสดงทางด้าน\ifpageodd{ขวา}{ซ้าย}มือ
52 | เส้นทางดังกล่าวมีระยะทางเท่ากับ $\mathrm{12}$ หน่วย ซึ่งเป็น optimal solution
53 | \item แต่หากโชคไม่ค่อยดี Greedy algorithm มีโอกาสพบเส้นทางอื่นเช่น ({\hrsp}b{\hrsp}) หรือ ({\hrsp}c{\hrsp})
54 | ซึ่งมีระยะทางรวมเท่ากับ $\mathrm{14}$ หน่วย
55 | และ $\mathrm{11} + \sqrt{\mathrm{5}}\approx\mathrm{13.236}$ หน่วยตามลำดับ
56 | \end{itemize}
57 |
58 | \noindent
59 | จงหาเส้นทางที่ Greedy algorithm นี้มีโอกาสค้นพบ ที่มีระยะทางมากกว่า $\dfrac{\mathrm{160}}{\mathrm{9}}$ หน่วย
60 |
61 |
--------------------------------------------------------------------------------
/questions02_ponder/national_makechange.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ในปัจจุบัน เงินตราที่นิยมใช้กันแพร่หลายในประเทศไทยประกอบไปด้วยเหรียญกษาปณ์หรือธนบัตรชนิดราคา\;
4 | 1 บาท, 2 บาท, 5 บาท, 10 บาท, 20 บาท, 50 บาท, 100 บาท, 500 บาท และ 1000 บาท ตามลำดับ
5 |
6 | สมมติว่าเราต้องการชำระยอดหนี้ก้อนหนึ่งซึ่งมีมูลค่า $d$ บาท
7 | โดยมี\emph{{\hrsp}เป้าหมาย{\hrsp}}ว่าจะต้องใช้เงินตราเป็นจำนวน\uline{น้อยที่สุด}เพื่อชำระหนี้ดังกล่าว\uline{ให้พอดี}\;
8 | สังเกตว่าเราสามารถใช้ \textbf{Greedy algorithm} ดังต่อไปนี้ เพื่อบรรลุ{\hrsp}\emph{เป้าหมาย}{\hrsp}ดังกล่าวได้\hrsp%
9 | \sidenote{%
10 | หมายความว่า \textbf{Greedy algorithm} ให้ผลลัพธ์เป็น \emph{optimal} สำหรับเงินตราที่ระบุไว้ข้างต้น
11 | }
12 | ไม่ว่ายอดหนี้ $d$ จะมีมูลค่ากี่บาทก็ตาม
13 |
14 | \begin{quote}
15 | \textbf{Greedy algorithm.} เราจะเลือกเหรียญกษาปณ์หรือธนบัตรที่มีมูลค่ามากที่สุดที่เป็นไปได้ที่ไม่เกินยอดหนี้ นำไปหักจากยอดหนี้
16 | ทำเช่นนี้ไปเรื่อย ๆ จนกว่ายอดหนี้จะลดลงเหลือ 0 บาท
17 |
18 | ยกตัวอย่างเช่น หากเราต้องการชำระหนี้มูลค่า $d = \mathrm{94}$ บาท เราสามารถจ่ายด้วยเหรียญกษาปณ์หรือธนบัตรที่มีมูลค่า
19 | $\mathrm{50+20+20+2+2}$ ตามลำดับ ซึ่งหมายความว่าเราใช้จำนวนเงินตรา 5 อัน ซึ่งน้อยที่สุดที่เพียงพอจะชำระหนี้ดังกล่าวพอดี
20 | \end{quote}
21 |
22 | \uline{อย่างไรก็ดี} สมมติว่าวันหนึ่ง\,ประเทศไทยจะเพิ่มเหรียญกษาปณ์หรือธนบัตรชนิดราคาใหม่จำนวน
23 | 1 ชนิดราคาเข้ามาในระบบ สังเกตว่า
24 |
25 | \begin{itemize}[before*=\small]
26 |
27 | \item ถ้าสมมติว่าประเทศไทยตัดสินใจเพิ่มเหรียญกษาปณ์ชนิดราคา 4 บาทเข้ามาในระบบ แล้ว \textbf{Greedy algorithm}
28 | ข้างต้นจะไม่รับประกันว่าจะให้ผลลัพธ์ที่ optimal เสมอไป\;
29 | (เช่น หากต้องการชำระเงิน $d = \mathrm{8}$ บาท \textbf{Greedy algorithm} จะจ่ายด้วยเหรียญ $\mathrm{5+2+1}$ บาทตามลำดับ
30 | แทนการใช้วิธี $\mathrm{4+4}$ บาทที่ใช้จำนวนเงินตราน้อยกว่า)
31 |
32 | \item แต่ถ้าเราเพิ่มเหรียญกษาปณ์ชนิดราคา 3 บาทแล้ว \textbf{Greedy algorithm} จะยังคงให้จำนวนเงินตราที่ optimal
33 | อยู่ไม่ว่ายอดหนี้ $d$ จะมีมูลค่าเท่าใดก็ตาม
34 |
35 | \end{itemize}
36 |
37 | \uline{จงหาเงินตราที่มีชนิดราคาสูงที่สุด 1 ชนิดราคา} ที่เมื่อเพิ่มเข้ามาในระบบแล้วจะทำให้
38 | \textbf{Greedy algorithm} ให้ผลลัพธ์ไม่เป็น optimal สำหรับยอดหนี้บางจำนวน\sidenote[][-\baselineskip]{%
39 | พร้อมทั้งยกตัวอย่างค้านว่า ยอดหนี้ $d$ มูลค่าเท่าใดที่ทำให้ \textbf{Greedy algorithm} ให้ผลลัพธ์ที่ไม่เป็น optimal
40 | }
41 |
--------------------------------------------------------------------------------
/questions02_ponder/national_picturehang.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | เราต้องการแขวนกรอบรูปอันหนึ่งด้วยเชือก 1 เส้นที่ร้อยจากขอบซ้ายของรูป คล้องเหนือหมุดบนกำแพงบางอัน
4 | แล้วมาร้อยเชื่อมกับขอบขวาของรูป
5 |
6 | \marginnote[\baselineskip]{%
7 | \centering
8 |
9 | \noindent
10 | \includegraphics[scale=0.5]{figures/ponder_national_picturehang_01.eps}
11 | \hfill
12 | \includegraphics[scale=0.5]{figures/ponder_national_picturehang_02.eps}
13 |
14 | \bigskip\noindent
15 | \includegraphics[scale=0.5]{figures/ponder_national_picturehang_03.eps}
16 | \hfill
17 | \includegraphics[scale=0.5]{figures/ponder_national_picturehang_04.eps}
18 | }
19 |
20 | \medskip\noindent
21 | \textbf{\uline{ตัวอย่าง}\; หมุด 2 ตัว} ---
22 | สมมติว่าเราเลือกที่จะแขวนรูปโดยการร้อยเชือกกับหมุด 2 ตัวในรูปแบบต่าง ๆ ดังนี้
23 | \begin{itemize}[before*=\small]
24 | \item \textbf{รูปสีฟ้า:} หากเราแขวนรูปด้วยวิธีปกติ (ดังรูปสีฟ้า) เราพบว่าหากหมุด\uline{ตัวใดตัวหนึ่ง}ถูกดึงออกไป
25 | หมุดอีกตัวหนึ่งจะยังสามารถรั้งกรอบภาพ\uline{ไม่ให้ตก}ตามแรงโน้มถ่วงได้
26 | \item \textbf{รูปสีเขียว:} แต่หากเราแขวนอีกแบบหนึ่ง (ดังรูปสีเขียว) เราพบว่ากรอบภาพจะยังคงแขวนได้เช่นกัน
27 | แต่หากหมุดตัวใดตัวหนึ่งถูกดึงออกไป กรอบภาพจะ\uline{หลุดลงมาทันที}แม้ว่าหมุดอีกตัวจะยังยึดกำแพงอยู่ก็ตาม
28 | \end{itemize}
29 |
30 | \noindent
31 | \textbf{\uline{โจทย์}\; หมุด 3 ตัว} ---
32 | หากเรามีหมุดสามอัน คือ A, B, C เรียงจากซ้ายไปขวา (ดู\textbf{รูปสีส้ม}ประกอบ)
33 | เราต้องการร้อยเชือกรอบหมุดให้สอดคล้องกับเงื่อนไขต่อไปนี้
34 | \begin{itemize}
35 | \item หากดึงหมุด A หรือหมุด C อันใดอันหนึ่ง รูปจะยังรั้งไว้ได้ ไม่หล่นลงมา
36 | \item หากดึงหมุด B หมุดเดียว รูปจะหล่นลงมาทันที
37 | \item หากดึงทั้งหมุด A และหมุด C ทั้งสองหมุด รูปจะหล่นลงมาเช่นกัน
38 | \end{itemize}
39 |
40 | \noindent
41 | จงหาวิธีแขวน{\hrsp}\textbf{รูปสีส้ม}{\hrsp}ที่สอดคล้องกับเงื่อนไขข้างต้น\hrsp%
42 | \sidenote{%
43 | นอกจากนี้ ยังมี\uline{ข้อห้าม}เกี่ยวกับการแขวนรูปดังนี้
44 | \begin{itemize}
45 | \item \uline{ห้าม}ใช้เชือกคล้องกันเอง (ดังเช่น{\hrsp}\textbf{รูปสีแดง}\hrsp) ในรูปนี้ให้ถือว่าเชือกขดทับกันแต่ไม่ไขว้กัน
46 | ซึ่งแปลว่ารูปจะไม่ถูกแขวนได้สำเร็จแต่แรก
47 | \item นอกจากนั้น \uline{ห้าม}มัดเชือกกันเองเป็นปมเพื่อแขวนรูป
48 | \end{itemize}
49 | }
50 |
51 | % https://firebasestorage.googleapis.com/v0/b/kbtg-techjam-code-questions.appspot.com/o/questions%2F42e9879c-9f26-4db2-874b-a047489f5286%2FHangingFrame.png?alt=media&token=d48a294b-0c99-4b49-9099-35d7e3936dff
--------------------------------------------------------------------------------
/questions02_ponder/national_tetris.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงศึกษาตัวอย่างโจทย์ต่อไปนี้ แล้วจึงแก้โจทย์ในช่วงท้ายของคำถาม
4 |
5 | \marginnote{%
6 | \centering
7 | \includegraphics[width=0.98\linewidth]{figures/ponder_national_tetris.eps}
8 | \vspace{\baselineskip}
9 | }
10 |
11 | \smallskip\noindent
12 | \textbf{\uline{ตัวอย่าง}} พิจารณารูปที่ปรากฏทาง\ifpageodd{ขวา}{ซ้าย}มือ
13 | เป็นพื้นที่สี่เหลี่ยมผืนผ้าขนาด $\mathrm{8 \times 5}$ หน่วย
14 | ซึ่งถูกตัดแบ่งออกเป็นชิ้นส่วน TETRIS{\textregistered} ประกอบกัน 10 ชิ้น ด้วยการขีดเส้นปากกาดังรูป
15 | (แสดงด้วยเส้นสีน้ำเงินทึบภายในกรอบสี่เหลี่ยม)\; พบว่าความยาวเส้นปากกาดังกล่าวคือ 35 หน่วย\hrsp%
16 | \sidenote{%
17 | \textbf{หมายเหตุ}\; ความยาวของเส้นปากกา เรานับเฉพาะเส้นที่คั่นระหว่างชิ้นส่วน
18 | TETRIS{\textregistered} สองชิ้น และไม่นับเส้นกรอบ
19 | }
20 |
21 | สังเกตว่า หากพื้นที่สี่เหลี่ยมผืนผ้านี้ถูกแบ่งเป็นชิ้นส่วน TETRIS{\textregistered} ในรูปแบบที่ต่างออกไป
22 | อาจจะต้องขีดเส้นปากกาที่มีความยาวรวมมากกว่าหรือน้อยกว่า 35 หน่วยก็ได้
23 |
24 | \smallskip\noindent
25 | \textbf{\uline{โจทย์}}\; ให้พิจารณาพื้นที่สี่เหลี่ยมผืนผ้าขนาด $\mathrm{12 \times 9}$ หน่วย
26 | หากเราใช้ปากกขีดเส้น\uline{ภายใน}
27 | กรอบสี่เหลี่ยม เพื่อแบ่งให้พื้นที่ว่างในกรอบเป็นชิ้นส่วน TETRIS{\textregistered} จำนวน 27 ชิ้น
28 |
29 | จงคำนวณหาว่า เส้นปากกาที่ขีดในกรอบสี่เหลี่ยมดังกล่าวจะมีความยาวรวม\uline{น้อยที่สุด}และ
30 | \uline{มากที่สุด}กี่หน่วย?
31 |
32 |
--------------------------------------------------------------------------------
/questions02_ponder/national_validatearray.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้ \lstinline{validate_array(A)} คือฟังก์ชันที่รับ input argument
4 | เป็น 0-indexed array \lstinline{A} ของจำนวนเต็ม\;
5 | และให้ output result เป็นค่า boolean ที่เป็น \lstinline{true} หรือ \lstinline{false} เท่านั้น\;
6 | ฟังก์ชันดังกล่าว สามารถเขียนเป็น pseudocode ได้ดังนี้
7 | \begin{fullwidth}
8 | \vspace*{-\baselineskip}
9 | \begin{lstlisting}
10 | function validate_array(A[0...n-1]):
11 | return (0 ≤ A[i] ≤ n-1 and A[i] == A[A[i]] for each i := 0 to n-1) <%\SuppressNumber%>
12 | and (A[i-1] ≤ A[i] for each i := 1 to n-1) <%\ReactivateNumber%>
13 | end
14 | \end{lstlisting}
15 | \end{fullwidth}
16 |
17 | \smallskip\noindent
18 | ตัวอย่างของการเรียกใช้ฟังก์ชันข้างต้น
19 | \begin{itemize}[itemsep=0pt]
20 | \item \lstinline|validate_array(A = [0, 1, 1, 3]) # => true|
21 | \item \lstinline|validate_array(A = [2, 2, 2, 2]) # => true|
22 | \item \lstinline|validate_array(A = [1, 2, 3, 3]) # => false|
23 | \item \lstinline|validate_array(A = [3, 1, 1, 3]) # => false|
24 | \end{itemize}
25 |
26 | \textbf{\uline{โจทย์}}\; จงหา\uline{จำนวนรูปแบบ}ทั้งหมดของ input array \lstinline|A|
27 | ที่มีจำนวนสมาชิก 20 ตัวที่ทำให้ \lstinline|validate_array(A)| คืนค่าออกมาเป็น \lstinline|true|?
28 |
--------------------------------------------------------------------------------
/questions02_ponder/national_vault.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | มีตู้เซฟอยู่ตู้หนึ่ง ตู้เซฟนี้ถูกล็อกด้วยหมายเลขปริศนา \lstinline{Q} ซึ่งมีความยาว 6 หลัก
4 | (เราเรียก \lstinline{Q} ว่า\emph{\hrsp รหัสผ่านจริง\hrsp})
5 |
6 | ทุก ๆ ครั้งที่เราป้อนรหัสเซฟเพื่อเปิดตู้เซฟตู้นี้ หากเราป้อนรหัสไม่ถูกต้อง ตู้เซฟจะมีเสียงร้องพร้อมทั้งยังมีข้อความตอบกลับ
7 | (response message) ว่า
8 | \begin{quote}
9 | \centering
10 | เลขโดดที่อยู่ติดกันที่ยาวที่สุดที่ปรากฏทั้งในรหัสผ่านจริง \lstinline{Q} \\
11 | และ\emph{\hrsp รหัสผ่านที่ป้อนผิด\hrsp}นั้นมีความยาวเท่าใด\hrsp%
12 | \sidenote{%
13 | พูดอีกนัยหนึ่งคือ response message จะเป็นความยาวของ
14 | \textbf{Longest common substring} (\lstinline{LCS})
15 | ระหว่างรหัสผ่านจริง \lstinline{Q} กับ\emph{\hrsp รหัสผ่านที่ป้อนผิด\hrsp}
16 |
17 | \smallskip
18 | \textbf{ตัวอย่าง}\; สมมติว่ารหัสผ่านจริงของตู้เซฟคือ
19 | \begin{center}
20 | \lstinline{Q = 123456}
21 | \end{center}
22 | แต่เราป้อนรหัสตู้เซฟเป็น
23 | \begin{center}
24 | \lstinline{A = 134579}
25 | \end{center}
26 | แล้วตู้เซฟจะมี response message ตอบกลับออกมาเป็น
27 | \begin{center}
28 | \lstinline{LCS(A, Q) = 3}
29 | \end{center}
30 | }
31 | \end{quote}
32 |
33 | ต่อไปนี้คือประวัติของการลองป้อนรหัสเซฟแก่ตู้เซฟนี้ทั้งสิ้น 9 ครั้ง พร้อมทั้ง response message ในแต่ละครั้ง
34 | \begin{center}
35 | \smallskip
36 | \begin{tabular}{@{\quad}c@{\qquad\qquad}c@{\quad}}
37 | \toprule
38 | รหัสผ่านที่ป้อน \lstinline|A| & ข้อความตอบกลับ \lstinline|LCS(A, Q)| \\
39 | \midrule
40 | \verb|027292| & \verb|1| \\
41 | \verb|135135| & \verb|0| \\
42 | \verb|257015| & \verb|2| \\
43 | \verb|362447| & \verb|1| \\
44 | \verb|470619| & \verb|3| \\
45 | \verb|560968| & \verb|1| \\
46 | \verb|674669| & \verb|1| \\
47 | \verb|822642| & \verb|1| \\
48 | \verb|903287| & \verb|3| \\
49 | \bottomrule
50 | \end{tabular}
51 | \smallskip
52 | \end{center}
53 |
54 | จงหารหัสผ่านจริง \lstinline{Q} ของตู้เซฟนี้จากข้อมูลข้างต้น
55 |
--------------------------------------------------------------------------------
/questions02_ponder/north_audition_randommod.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้ \lstinline{rand7()} เป็นฟังก์ชันที่สุ่มจำนวนเต็มในช่วงตั้งแต่ 1 ถึง 7 ด้วยความน่าจะเป็นเท่า ๆ กัน
4 |
5 | ให้พิจารณานิพจน์ดังต่อไปนี้\hrsp%
6 | \sidenote[][1.65\baselineskip]{%
7 | \textbf{หมายเหตุ}\; binary operator \lstinline{mod}
8 | คือการหารที่เอาเฉพาะเศษเป็นผลลัพธ์ของนิพจน์นั้น เช่น \lstinline{13 mod 3 = 1}
9 | }
10 | ที่สุ่มจำนวนเต็ม 1 จำนวนในช่วงตั้งแต่ 1 ถึง 11
11 | \begin{center}
12 | \lstinline{((rand7() + rand7()) mod 11) + 1}
13 | \end{center}
14 |
15 | อยากทราบว่า output ของนิพจน์ข้างต้นที่เป็นไปได้มากที่สุด มีค่าเท่าใด?
16 |
--------------------------------------------------------------------------------
/questions02_ponder/north_audition_twosidecoin.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | นายกสิกรเขียนอักขระภาษาอังกฤษ 1 ตัว ลงบนแต่ละหน้าของเหรียญ 4 เหรียญ โดยไม่มีตัวอักขระตัวใดซ้ำกันเลย
4 | จากนั้นเขาโยนเหรียญทั้ง 4 เหรียญลงบนโต๊ะอย่างสุ่ม แล้วนำอักขระบนเหรียญด้านที่หงายมาเรียงเป็นคำ
5 | ทำอย่างนี้ทั้งหมด 3 ครั้ง สะกดได้คำว่า ``BOAT'', ``NODE'' และ ``RANT'' ตามลำดับ
6 |
7 | อยากทราบว่า คำใด\uline{บ้าง}ต่อไปนี้ที่ไม่สามารถสะกดจากอักขระที่ปรากฏบนเหรียญได้?
8 | \begin{multicols}{4}
9 | \begin{itemize}[label={$\square$}]
10 | \item BART
11 | \item DONE
12 | \item BORE
13 | \item NEAR
14 | \end{itemize}
15 | \end{multicols}
16 |
--------------------------------------------------------------------------------
/questions02_ponder/north_regional_goodtimes.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีนาฬิกาดิจิทัลอยู่เรือนหนึ่ง มีลักษณะเป็น 24-hour clock
4 | ที่แสดงผลในรูปแบบ \texttt{HH:MM:SS} ตั้งแต่เวลา \texttt{00:00:00} ไปจนถึง \texttt{23:59:59}
5 |
6 | \medskip\noindent
7 | \textbf{\uline{นิยาม}}\;
8 | เวลา ณ วินาทีหนึ่ง ๆ จะเป็น ``เวลาเลขสวย'' ก็ต่อเมื่อการแสดงผลบนหน้าปัดนาฬิกา%
9 | ประกอบไปด้วยเลขโดดที่แตกต่างกัน\uline{ไม่เกิน 2 ตัว}เท่านั้น ยกตัวอย่างเช่น
10 | \begin{itemize}[before*=\small]
11 | \item \texttt{13:31:11} เป็นเวลาเลขสวย เนื่องจากแสดงผลได้ด้วยเลขโดด 1 และ 3 เพียงสองตัว
12 | \item \texttt{11:11:11} เป็นเวลาเลขสวย เพราะใช้เลขโดดเพียงตัวเดียว (ยังไม่เกิน 2 ตัว)
13 | \item \texttt{23:00:00} ไม่เป็นเลขสวย เนื่องจากต้องใช้ตัวเลขโดดถึง 3 ตัวในการแสดงผล
14 | \end{itemize}
15 |
16 | \noindent
17 | \textbf{\uline{โจทย์}}\;
18 | จงหาว่า ในช่วงเวลาตั้งแต่ \texttt{01:30:00} ไปจนถึง \texttt{21:00:00}
19 | นาฬิกาดิจิทัลจะปรากฏเวลาเลขสวยทั้งหมดกี่ครั้ง?
20 |
--------------------------------------------------------------------------------
/questions02_ponder/north_regional_subsetsum.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้ $S = \{\mathrm{1, 2, 3, \ldots, 10}\}$ เป็นเซตของจำนวนเต็ม
4 |
5 | หากเราต้องการคัดเลือกจำนวนบางจำนวนจากเซต $S$ ที่ไม่ซ้ำกันอย่างน้อย 1 จำนวน
6 | โดยที่ผลรวมของจำนวนที่เลือกมากนั้นจะต้องหารด้วย 10 ลงตัวพอดี\hrsp%
7 | \sidenote{
8 | \textbf{ยกตัวอย่าง} บางวิธีที่กระทำได้ เช่น
9 | $\mathrm{10}$,\; $\mathrm{1+9}$,\; $\mathrm{2+3+5}$,\; $\mathrm{2+5+6+7}$
10 | เป็นต้น
11 |
12 | }
13 |
14 | อยากทราบว่าจะกระทำได้ทั้งหมดกี่วิธี?
15 |
--------------------------------------------------------------------------------
/questions02_ponder/north_regional_sumcell.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงหาผลรวมของจำนวนทุกจำนวนที่ปรากฏในตารางดังต่อไปนี้
4 | \[
5 | \footnotesize
6 | \begin{bmatrix}
7 | 1 & 2 & 3 & \cdots & \cdots & 15000 \\
8 | 2 & 3 & 4 & \cdots & \cdots & 15001 \\
9 | 3 & 4 & 5 & \cdots & \cdots & 15002 \\
10 | \vdots & \vdots & \vdots & \ddots & & \vdots \\
11 | \vdots & \vdots & \vdots & & \ddots & \vdots \\
12 | 15000 & 15001 & 15002 & \cdots & \cdots & 29999 \\
13 | \end{bmatrix}_{15000 \times 15000}
14 | \]
15 |
16 | \textbf{หมายเหตุ}\; ข้อนี้อาจต้องใช้ 64-bit integer
--------------------------------------------------------------------------------
/questions02_ponder/north_regional_trailingzeros.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้ \lstinline{A} เป็น Array ของเลขจำนวนเต็มดังต่อไปนี้
4 | \begin{center}
5 | \lstinline{A = [133, 60, 96, 130, 125, 65, 482, 88, 220, 165, 25, 45]}
6 | \end{center}
7 |
8 | จงเลือกจำนวน 3 จำนวนที่ไม่ซ้ำกันจาก \lstinline{A} แล้วหาผลคูณที่ลงท้ายด้วยเลขโดด 0 เยอะที่สุด
9 | \uline{ผลคูณดังกล่าวมีค่าเท่าใด}?
10 |
--------------------------------------------------------------------------------
/questions02_ponder/northeast_audition_sqroot.tex:
--------------------------------------------------------------------------------
1 | \question{\label{q:ponder_northeast_audition_sqroot}}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้\,\sidenote[][6.15\baselineskip]{%
4 | \textbf{หมายเหตุ}\; \lstinline{floor}
5 | คือฟังก์ชันที่ปัดเศษของจำนวนเต็มทิ้งให้กลายเป็นจำนวนเต็มที่มากที่สุดที่น้อยกว่าหรือเท่ากับจำนวนเดิม
6 | }
7 | \begin{lstlisting}
8 | function mystery_<%\ref*{q:ponder_northeast_audition_sqroot}%>(n):
9 | # n <%\codecmt เป็นจำนวนเต็มที่ไม่ติดลบ%>
10 | lb := 0
11 | ub := n
12 | loop:
13 | attempt := floor((lb + ub) / 2)
14 | if n < attempt^2:
15 | ub := attempt - 1
16 | elseif n >= (attempt + 1)^2:
17 | lb := attempt + 1
18 | else:
19 | break loop and return attempt
20 | end
21 | end
22 | end
23 | \end{lstlisting}
24 | โปรแกรมข้างต้นทำหน้าที่ตามที่ระบุในข้อใดต่อไปนี้?
25 |
26 | \begin{itemize}[label={$\Circle$}]
27 | \item ฟังก์ชัน square root แต่ปัดเศษเป็นจำนวนเต็มที่ใกล้ที่สุดเสมอ\\ (round to nearest integer)
28 | \item ฟังก์ชัน square root แต่ปัดเศษทิ้งเป็นจำนวนเต็มเสมอ (round down)
29 | \item ฟังก์ชัน square root แต่ปัดเศษขึ้นเป็นจำนวนเต็มเสมอ (round up)
30 | \item ฟังก์ชัน square root แต่เศษอาจถูกปัดขึ้นหรือลงอย่างไรก็ได้ ไม่สามารถคาดเดาได้
31 | \item ฟังก์ชันติด infinite loop ไม่รู้จบ
32 | \end{itemize}
33 |
--------------------------------------------------------------------------------
/questions02_ponder/northeast_audition_timecomplexeasy.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | จงพิจารณาโปรแกรมดังต่อไปนี้
4 | \begin{lstlisting}
5 | function f(n):
6 | if n ≤ 1 then:
7 | return 1
8 | else:
9 | x = f(n/2)
10 | y = f(n/2)
11 | return g(n, x, y)
12 | end
13 | end
14 | \end{lstlisting}
15 |
16 | หากกำหนดให้ time complexity ของฟังก์ชัน \lstinline{g(n, ·, ·)} คือ $O(\mathtt{n})$
17 | แล้วจงคำนวณหา time complexity ของฟังก์ชัน \lstinline{f(n)}
18 |
--------------------------------------------------------------------------------
/questions02_ponder/northeast_regional_licenseplate.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | นายกสิกรเข้าร่วมในงานประมูลทะเบียนรถหมวด ``ฃฅ''
4 | ซึ่งมีการเปิดประมูลเลขทะเบียนรถทุกหมายเลข ตั้งแต่ 1 จนถึง 9999
5 |
6 | นายกสิกรเคยได้ยินจากหมอดูหลายท่านว่า หากต้องการให้ชีวิตมั่งคั่งร่ำรวย จะต้องมี ``ผลรวมเลขโดดสุดท้าย''\hrsp%
7 | \sidenote{%
8 | ผลรวมเลขโดดสุดท้าย คือการหาผลรวมเลขโดดของจำนวนจำนวนหนึ่ง
9 | ซ้ำ ๆ กันไปเรื่อย ๆ จนกว่าจะเหลือเลขโดดเพียงตัวเดียว
10 | }
11 | เป็น 8 เช่น
12 | \begin{itemize}[before*=\small]
13 | \item ป้ายทะเบียน 7595 \uline{เป็นป้ายทะเบียนมั่งคั่ง} \\
14 | เพราะ $\mathrm{7 + 5 + 9 + 5 = 26} \;\Longrightarrow\; \mathrm{2 + 6 = 8}$
15 | \item แต่ป้ายทะเบียน 7777 \uline{ไม่มั่งคั่ง} \\
16 | เพราะ $\mathrm{7 + 7 + 7 + 7 = 28} \;\Longrightarrow\; \mathrm{2 + 8 = 10} \;\Longrightarrow\; \mathrm{1 + 0 = 1 \neq 8}$
17 | \end{itemize}
18 |
19 | จงคำนวณว่า ในบรรดาป้ายทะเบียนในเปิดประมูลทั้งหมดในหมวด ``ฃฅ'' ในวันนี้
20 | จะมีป้ายทะเบียนมั่งคั่งเป็นจำนวนกี่ป้าย?
21 |
--------------------------------------------------------------------------------
/questions02_ponder/northeast_regional_maketriangle.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | สมมติว่าเรามีกองแท่งไม้ 5000 แท่ง แท่งไม้แต่ละแท่งมีความยาว 1, 2, 3, \ldots, 5000 หน่วยตามลำดับ\;
4 | เราต้องการสร้างสามเหลี่ยมที่มี\uline{พื้นที่ภายในมากกว่าศูนย์}\hrsp%
5 | \sidenote[][-\baselineskip]{%
6 | สามเหลี่ยมใด ๆ ที่มีพื้นที่มากกว่าศูนย์จะต้องมีผลรวมความยาวของด้าน 2 ด้านใด ๆ ยาวกว่าด้านที่สามเสมอ เช่น
7 | \begin{itemize}
8 | \item 3, 4, 5 ประกอบเป็นความยาวด้านของสามเหลี่ยม\uline{ได้}
9 | \item 1, 3, 5 ประกอบเป็นความยาวด้านของสามเหลี่ยม\uline{ไม่ได้} เพราะ $\mathrm{1 + 3 < 5}$
10 | \item 1, 2, 3 ประกอบเป็นความยาวด้านของสามเหลี่ยมได้ แต่จะมี\uline{พื้นที่เท่ากับ 0}
11 | \end{itemize}
12 | }
13 | โดยการหยิบแท่งไม้จากกองดังกล่าวมา 3 แท่งมาประกอบกัน
14 |
15 | อยากทราบว่าเราจะมีวิธีเลือกหยิบแท่งไม้ 3 แท่งจากกองดังกล่าว
16 | ประกอบให้กลายเป็นสามเหลี่ยมที่มีพื้นที่มากกว่าศูนย์ได้กี่วิธี?
17 |
18 | \textbf{หมายเหตุ}\; ข้อนี้อาจต้องใช้ 64-bit integer
19 |
--------------------------------------------------------------------------------
/questions02_ponder/south_audition_countdigits.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ธนาคารกสิกรไทยสาขา {\techjam} ได้ก่อสร้างอาคารสูง 1000 ชั้นเสร็จหมาด ๆ\;
4 | เจ้าหน้าที่ต้องการติดป้ายบอกชั้นตั้งแต่ชั้นที่ 1 ถึงชั้นที่ 1000 ชั้นละ 1 ชุด
5 | โดยเลขแต่ละชุดเกิดจากการนำแผ่นกระดานที่มีเลขโดด 0 ถึง 9
6 | หลายแผ่นมาประกอบกันแล้วนำไปติดตามชั้นต่าง~ๆ\hrsp%
7 | \sidenote{%
8 | \textbf{ตัวอย่าง} เช่นชั้นที่ 37 จะต้องใช้แผ่นกระดานเลขโดด 3 และ 7 อย่างละ 1 แผ่น
9 | }
10 |
11 | อยากทราบว่าเจ้าหน้าที่ต้องเตรียมแผ่นกระดานที่มีเลขโดด 9 ทั้งหมดกี่แผ่น
12 | เพื่อนำมาติดป้ายให้ครบทุกชั้น?
13 |
--------------------------------------------------------------------------------
/questions02_ponder/south_audition_dfsbst.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีต้นไม้ค้นหาแบบทวิภาค (Binary search tree) อยู่ต้นหนึ่ง
4 | ซึ่งประกอบไปด้วยจำนวนบางจำนวนที่อยู่ระหว่าง 1 กับ 100 ปรากฏอยู่
5 |
6 | หากเราต้องการค้นหาข้อมูลซึ่งคือจำนวน 56 ภายในต้นไม้ข้างต้นนี้\;
7 | ข้อใดต่อไปนี้เป็นลำดับการเกิด tree traversal ที่เริ่มต้นจากราก (root) เพื่อค้นห้าข้อมูลดังกล่าว
8 | ที่ไม่สามารถเกิดขึ้นได้?
9 |
10 | \begin{multicols}{2}
11 | \begin{enumerate}[label={$\Circle$}]
12 | \item 7, 82, 46, 66, 43, 58, 56
13 | \item 92, 13, 66, 34, 61, 41, 56
14 | \item 13, 77, 62, 41, 59, 57, 56
15 | \item 77, 11, 72, 59, 13, 52, 56
16 | \end{enumerate}
17 | \end{multicols}
18 |
--------------------------------------------------------------------------------
/questions02_ponder/south_regional_comptreehard.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มี input ทั้งสิ้น 3 จำนวน ได้แก่จำนวนจริง $x$, $y$ และ $z$
4 |
5 | จาก input ข้างต้นนี้ เป้าหมายคือการคำนวณค่าของนิพจน์ $ax + by + cz$
6 | โดยที่ $a$, $b$ และ $c$ เป็นค่าคงที่จำนวนเต็มที่ไม่ติดลบ
7 | โดยใช้ operation การบวกเป็น\uline{จำนวนครั้งน้อยที่สุด}\;
8 | ภายใต้เงื่อนไขดังต่อไปนี้
9 |
10 | \begin{itemize}
11 | \item อนุญาตให้ใช้เฉพาะ operation การบวก
12 | \item อนุญาตให้นำผลบวกที่เกิดขึ้นก่อนหน้านั้น\uline{ระหว่างการคำนวณ}
13 | มาใช้เป็นตัวตั้งหรือตัวบวกของการบวกครั้งถัดไปได้\hrsp%
14 | (หมายความว่า เรามีการ\uline{จดบันทึก}ผลการบวกที่เกิดขึ้นทั้งหมด
15 | คล้ายกับ history tape ในเครื่องคิดเลขของนักบัญชี)
16 | \end{itemize}
17 |
18 | \noindent
19 | \textbf{\uline{ตัวอย่าง}} สมมติว่าเราต้องการคำนวณ $x + \mathrm{2}y + \mathrm{3}z$ ในเคสทั่วไป
20 | เราอาจคำนวณตามลำดับในสมการ $x + y + y + z + z + z$ ซึ่งใช้การบวกทั้งสิ้น 5 ครั้ง\;
21 | แต่เนื่องจากเงื่อนไขอนุญาตให้นำผลบวกก่อนหน้ามาใช้งานได้ เราสามารถใช้การบวกน้อยที่สุดเพียง 4 ครั้งเท่านั้น
22 | ซึ่งเขียนเป็นขั้นตอนวิธีได้ดังนี้
23 | \begin{lstlisting}
24 | r_1 := y + z # => y + z
25 | r_2 := r_1 + r_1 # => 2y + 2z
26 | r_3 := r_2 + z # => 2y + 3z
27 | r_4 := r_3 + x # => x + 2y + 3z
28 | \end{lstlisting}
29 |
30 | \noindent
31 | \textbf{\uline{โจทย์}} การคำนวณหาค่าของ $x + \mathrm{4}y + \mathrm{9}z$ จาก input $x$, $y$ และ $z$
32 | จะต้องใช้ operation การบวกเป็นจำนวน\uline{น้อยที่สุด}กี่ครั้ง?
33 |
--------------------------------------------------------------------------------
/questions02_ponder/south_regional_iq180p1.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | กำหนดให้มีจำนวน 6 จำนวน ได้แก่ 1, 2, 5, 6, 7, 9
4 | ให้นำจำนวนเหล่านี้มา ``บวก{\hrsp--\hrsp}ลบ{\hrsp--\hrsp}คูณ{\hrsp--\hrsp}หาร''
5 | ให้ได้จำนวน 258 โดยที่มีเงื่อนไขดังนี้
6 | \begin{itemize}
7 | \item จะใช้ $+, -, \times, \div$ อย่างไรก็ได้ และจะจัดกลุ่มหรือใส่วงเล็บอย่างไรก็ได้
8 | \item จะใช้ตัวเลขในลำดับใดก็ได้ แต่ต้องใช้ตัวเลขทุกตัว ตัวละหนึ่งครั้งพอดี
9 | \end{itemize}
10 |
11 | \noindent
12 | จงหาวิธีการจัดนิพจน์ให้กับจำนวนทั้งหมดข้างต้น เพื่อให้ได้ผลลัพธ์ตามที่ต้องการ?
13 |
--------------------------------------------------------------------------------
/questions02_ponder/south_regional_sumofdigits.tex:
--------------------------------------------------------------------------------
1 | \question{}
2 |
3 | ในบรรดาจำนวนเต็มตั้งแต่ 1 ถึง 1000 มีกี่จำนวนซึ่งมีผลรวมเลขโดดที่ไม่มีเลขโดด 1
4 | ปรากฏภายในผลรวมเลขโดดนั้นเลย?\hrsp%
5 | \sidenote[][-\baselineskip]{%
6 | \textbf{ตัวอย่าง} เพื่อความชัดเจน
7 | \begin{itemize}
8 | \item เลข 123 มีผลรวมเลขโดดคือ $\mathrm{1+2+3=6}$ ซึ่ง\uline{ไม่มี}เลขโดด $\mathrm{1}$ อยู่ใน $\mathrm{6}$
9 | \item เลข 67 มีผลรวมเลขโดคือ $\mathrm{6+7=13}$ ซึ่ง\uline{มี}เลขโดด $\mathrm{1}$ อยู่ใน $\mathrm{13}$
10 | \end{itemize}
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/questions03_coding/central_regional_descendingdrills.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Descending Drills}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | ผืนดินแห่งหนึ่งมีสมบัติซ่อนอยู่ใต้ดินมากมาย เนื่องด้วยเทคโนโลยี Remote Sensing ในปัจจุบัน
6 | ทำให้เราสามารถสำรวจมูลค่าของสมบัติที่อยู่ใต้ดินในบริเวณต่าง ๆ ได้
7 | โดยที่เราไม่ต้องขุดสมบัติออกจากดินเพื่อมาตีราคาแต่อย่างใด
8 |
9 | เราจะมองชั้นดินที่เต็มไปด้วยสมบัติดังกล่าวเป็นพื้นที่หน้าตัดรูปสี่เหลี่ยมผืนผ้า
10 | ซึ่งเราจะแบ่งสี่เหลี่ยมผืนผ้าดังกล่าวเป็นชั้นดินลึก $R$ ชั้น ชั้นละ $C$ ช่อง
11 | ดินแต่ละช่องจะมีมูลค่าของสมบัติกำกับไว้ด้วยซึ่งเป็นจำนวนเต็มที่อาจเป็นบวก ลบ หรือศูนย์ก็ได้
12 |
13 | \bigskip\noindent
14 | \textbf{\uline{ตัวอย่าง}} รูปต่อไปนี้คือตัวอย่างข้อมูลของสมบัติในชั้นดินที่มี $R = 6$ และ $C = 6$
15 | \begin{center}
16 | \includegraphics[scale=0.6]{figures/coding_descendingdrills_01.eps}
17 | \end{center}
18 |
19 | \subsection*{\sectionfont\upshape Drilling Constraints}
20 | เราต้องการจะเจาะผืนดินเพื่อล่าสมบัติที่อยู่ในดินให้ได้ผลรวมมากที่สุด แต่เนื่องด้วยขีดจำกัดของนวัตกรรมการขุดเจาะที่ยังมีราคาแพง ทำให้เรามีโอกาสเดียวเท่านั้นในการขุดเจาะผืนดินดังกล่าว ลักษณะเส้นทางของการขุดดินจะมีเงื่อนไขดังนี้
21 | \begin{itemize}
22 | \item เราสามารถเริ่มต้นขุดเจาะจากผิวดิน เหนือช่องคอลัมน์ใดก็ได้
23 | \item ตลอดการขุดเจาะในครั้งนี้ เราสามารถขุดเจาะดินในแนวดิ่ง
24 | เผื่อลงไปยังชั้นดินชั้นต่อไปก็ได้ หรือจะขุดเจาะในแนวราบไปทางซ้ายหรือขวาในชั้นดินระดับเดียวกันก็ได้
25 | แต่ไม่สามารถเจาะสวนทางแรงโน้มถ่วงในทิศทางชี้สู่ผิวดินได้
26 | \item สำหรับการขุดเจาะแนวราบนั้น เมื่อเราขุดเจาะลงสู่ชั้นดินหนึ่ง ๆ
27 | เครื่องขุดเจาะอาจจะเลือกขุดเจาะไปทางซ้ายหรือทางขวา ทิศทางใดทิศทางหนึ่งเท่านั้น
28 | (หรือจะไม่ขยับในแนวราบก็ได้) และการขุดแนวราบดังกล่าว จะขยับจากจุดเริ่มต้นได้ไม่เกิน $K$ ช่อง
29 | \item เครื่องขุดเจาะไม่สามารถเดินถอยหลังไปยังช่องดินที่เคยขุดเจาะไปแล้วได้ ไม่ว่าจะเป็นแนวดิ่งหรือแนวราบก็ตาม
30 | \item การขุดเจาะจะสิ้นสุดที่ช่องใดก็ได้\;
31 | และมูลค่ารวมของสมบัติที่เก็บสะสมได้ คือผลรวมของมูลค่าของสมบัติทุกช่องที่เครื่องขุดเจาะนี้แทรกผ่าน
32 |
33 | \item ไม่จำเป็นว่าจะต้องขุดเจาะถึงชั้นผิวดินแถวล่างสุดเสมอไป
34 | \item สมบัติที่มีมูลค่าติดลบที่ค้นพบระหว่างทางจะต้องถูกนำมารวมในผลรวมด้วยเสมอ
35 | \item หากไม่มีรูปแบบการขุดเจาะที่ทำให้ผลรวมสมบัติเป็นบวกเลย สามารถตอบ \verb|0| ได้
36 | \end{itemize}
37 |
38 | \bigskip\noindent
39 | \textbf{\uline{ตัวอย่าง}} รูปต่อไปนี้มีเส้นสีส้มแสดงเส้นทางการขุดเจาะชั้นดิน เพื่อล่าสมบัติที่อยู่ในดิน\;
40 | โดยมีเงื่อนไขว่า $K=2$ สังเกตว่าไม่มีการขยับในแนวราบเกิน 2 ช่องเลยในทุกระดับชั้นดิน
41 |
42 | ผลรวมมูลค่าสมบัติที่ขุดเจาะตามเส้นทางตัวอย่างนี้คือ 63 หน่วย ซึ่งเป็นเส้นทางที่ดีที่สุดสำหรับรูปตัวอย่างนี้
43 | \begin{center}
44 | \vspace*{-1.5\baselineskip}
45 | \includegraphics[scale=0.6]{figures/coding_descendingdrills_02.eps}
46 | \end{center}
47 |
48 | \subsection*{\sectionfont\upshape Problem Statement}
49 |
50 | กำหนดให้มูลค่าของสมบัติในดินเป็นตารางสี่เหลี่ยมผืนผ้าขนาด $R$ แถวและ $C$ คอลัมน์
51 | จงหามูลค่าสมบัติรวมที่มากที่สุดที่เกิดจากการขุดเจาะด้วยโอกาสเพียง 1 ครั้งตามเงื่อนไขข้างต้น
52 |
53 | \subsection*{\sectionfont\upshape Program Specification}
54 |
55 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
56 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
57 |
58 | \bigskip\noindent
59 | {\sectionfont\bfseries Input Format}
60 | \begin{itemize}
61 | \item บรรทัดที่ 1: มีจำนวนเต็มสามตัว $R, C, K$ คั่นด้วยช่องว่าง
62 | \item อีก $R$ บรรทัดถัดมา บรรทัดที่ $i+1$ จะมีจำนวนเต็ม $C$ จำนวน คั่นด้วยช่องว่าง แทนมูลค่าของสมบัติในชั้นดินที่ $i$ เรียงจากซ้ายไปขวา
63 | \begin{lstlisting}
64 | R C K
65 | v[1, 1] v[1, 2] ... v[1, C]
66 | v[2, 1] v[2, 2] ... v[2, C] <%\SuppressNumber\AlternateNumber{...}%>
67 | <%\AlternateNumber{R+1}%>
68 | v[R, 1] v[R, 2] ... v[R, C] <%\ReactivateNumber%>
69 | \end{lstlisting}
70 | \end{itemize}
71 |
72 | \medskip\noindent
73 | {\sectionfont\bfseries Output Format}
74 | \begin{itemize}
75 | \item คำตอบประกอบด้วยจำนวนเต็มเพียงหนึ่งตัว
76 | ซึ่งระบุผลรวมของสมบัติที่มากที่สุดที่สามารถหาได้จากการขุดเจาะเพียงครั้งเดียวตามเงื่อนไขที่กำหนดไว้
77 | \end{itemize}
78 |
79 | \newpage
80 | \subsection*{\sectionfont\upshape Data Examples}
81 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
82 | \toprule
83 | Example Input & Example Output \\
84 | \midrule
85 | \ttfamily\setstretch{0.8}
86 | 6 6 2 \newline
87 | 3 -1 1 2 3 7 \newline
88 | 4 -2 7 4 4 -5 \newline
89 | 6 -5 1 -9 -2 6 \newline
90 | 8 7 -9 8 6 -8 \newline
91 | 1 9 2 6 -4 1 \newline
92 | 4 2 -9 4 -5 -3 &
93 | \ttfamily\setstretch{0.8} 63 \\
94 | \midrule
95 | \ttfamily\setstretch{0.8}
96 | 6 5 1 \newline
97 | -1 -1 -1 -1 -1 \newline
98 | -1 1 1 -1 -1 \newline
99 | -1 -1 -1 -1 -1 \newline
100 | -1 -1 1 1 -1 \newline
101 | -2 -2 -2 -2 -2 \newline
102 | -1 1 -1 1 0 &
103 | \ttfamily\setstretch{0.8} 2 \\
104 | \bottomrule
105 | \end{tabular}
106 |
107 | \medskip\noindent
108 | \textbf{อธิบายตัวอย่างที่ 2:} โปรดพิจารณารูปตัวอย่างต่อไปนี้ประกอบข้อมูลตัวอย่างข้างต้น
109 |
110 | \begin{center}
111 | \includegraphics[scale=0.6]{figures/coding_descendingdrills_03.eps}
112 | \includegraphics[scale=0.6]{figures/coding_descendingdrills_04.eps}
113 | \end{center}
114 |
115 | \subsection*{\sectionfont\upshape Constraints}
116 |
117 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
118 | \begin{itemize}
119 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า
120 | ขนาดของตารางจะสอดคล้องกับเงื่อนไขที่ว่า \\ $1 \leq R, C \leq 200$
121 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า
122 | จำนวนช่องในตารางจะสอดคล้องกับเงื่อนไขที่ว่า \\ $1 \leq RC \leq 2 \cdot 10^6$
123 | \item สำหรับทุก test cases จะมีเงื่อนไขว่า
124 | จำนวนช่องที่ขยับได้ในแนวราบในแถว ๆ หนึ่งจะสอดคล้องกับเงื่อนไข $0 \leq K < C$
125 | และมูลค่าสมบัติแต่ละช่องจะมีค่าที่สอดคล้องกับเงื่อนไข
126 | $-1000 \leq \text{\ttfamily v[i, j]} \leq 1000$
127 | \end{itemize}
128 |
--------------------------------------------------------------------------------
/questions03_coding/central_regional_lobbyingtollway.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Lobbying Tollway}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | บริษัทขนส่งสินค้าแห่งหนึ่ง จำเป็นต้องวางแผนการลำเลียงส่งสินค้าระหว่างเมืองสองเมืองในดินแดนที่มีเมืองทั้งสิ้น $N$ เมือง
6 | และมีโครงข่ายของถนน $M$ สายที่เชื่อมเมืองเหล่านี้ให้เดินทางไปมาหาสู่กันได้ทั้งหมด
7 | เมืองแต่ละเมืองจะมีหมายเลข $1$ ถึง $N$ ส่วนถนนแต่ละสายจะมีหมายเลข $1$ ถึง $M$ ตามลำดับ
8 |
9 | สำหรับแต่ละ $i=1,2,\ldots,M$ ถนนสายที่ $i$ จะเป็นถนนวิ่งทางเดียว (one-way road)
10 | ที่เชื่อมการเดินทางจากเมือง $u_i$ ไปยังเมือง $v_i$ เสมอ ($1 \leq u_i, v_i \leq N$)
11 | นอกจากนั้นอาจจะมีค่าผ่านทาง $p_i$ บาทที่คนใช้ถนนสายนี้ต้องจ่ายเพื่อใช้งาน ($p_i \geq 0$)
12 | นอกจากนั้น กำหนดว่าถ้าถนนสายไหนไม่มีค่าผ่านทาง นั่นแปลว่า $p_i = 0$
13 |
14 | พึงทราบว่า อาจมีถนนวิ่งทางเดียวที่เชื่อมจากเมืองหนึ่งไปยังอีกเมืองหนึ่ง มากกว่า 1 สายก็ได้
15 | นอกจากนั้นอาจมีถนนที่เชื่อมระหว่างเมืองสองเมือง ไป-กลับ โดยที่ถนนเหล่านี้เก็บค่าผ่านทางที่ไม่เท่ากันก็ได้
16 |
17 | โดยปกตินั้น บริษัทนี้ได้สำรวจเส้นทางทั้งหมดที่เป็นไปได้ เพื่อใช้ลำเลียงสินค้าจากเมืองหมายเลข $1$ ไปยังเมืองหมายเลข $N$
18 | โดยเส้นทางเหล่านี้ล้วนแต่เป็นเส้นทางที่เสียค่าผ่านทางรวมน้อยที่สุดทั้งสิ้น
19 |
20 | ในเวลาต่อมา บริษัทนี้ต้องการเปิดเส้นทางการลำเลียงสินค้าเพิ่มขึ้นอย่างน้อย 1 เส้นทาง โดยมีเงื่อนไขต่อไปนี้
21 | \begin{itemize}
22 | \item บริษัทจะไปล็อบบี้กับผู้บริหารของเครือข่ายถนน เพื่อให้ลดค่าผ่านทางของถนนเพียง 1 สายเท่านั้น
23 | \item ค่าผ่านทางใหม่นั้นจะติดลบไม่ได้
24 | \item ค่าผ่านทางใหม่นั้นจะต้องลดลงจากค่าผ่านทางเดิม เป็นปริมาณเงินน้อยที่สุดเท่าที่เป็นไปได้
25 | \item เส้นทางการลำเลียงสินค้าเดิมที่เคยสำรวจไว้จะต้องไม่กระทบ กล่าวคือเส้นทางเดิมแต่ละเส้นทางจะยังคงใช้งานได้เช่นเดิม และมีค่าผ่านทางรวมเท่าเดิม ไม่เพิ่มขึ้นหรือลดลง
26 | \item จะต้องมีเส้นทางใหม่การลำเลียงสินค้าเกิดขึ้นอย่างน้อย 1 เส้นทาง และจะต้องไม่ซ้ำกันเส้นทางเดิมที่บริษัทเคยสำรวจไว้ และราคาค่าผ่านทางรวมของเส้นทางใหม่นี้จะต้องเท่ากับราคาค่าผ่านทางรวมของเส้นทางเดิมอื่น ๆ ของบริษัทด้วย
27 | \end{itemize}
28 |
29 | \subsection*{\sectionfont\upshape Problem Statement}
30 |
31 | จงรับข้อมูลเครือข่ายถนนในดินแดนแห่งหนึ่ง รวมถึงค่าผ่านทางของถนนแต่ละสาย
32 | แล้วหาว่าบริษัทนี้จะต้องไปล็อบบี้เพื่อลดค่าผ่านทางของถนนสายใด 1 สาย
33 | และเป็นปริมาณเงินลดลงน้อยที่สุดเท่าใด จึงจะสามารถเปิดเส้นทางใหม่เพื่อใช้ลำเลียงสินค้าจากเมือง $1$ ไปเมือง $N$ ได้
34 | โดยเส้นทางใหม่ที่เกิดขึ้นนี้จะมีค่าผ่านทางรวมถูกที่สุด และถูกเท่า~ๆ กับเส้นทางอื่น~ๆ ที่เคยมีการสำรวจมาก่อนหน้านี้แล้ว
35 |
36 | หากมีถนนที่เป็นไปได้หลายสายที่สามารถล็อบบี้ให้ลดราคาลงเป็นปริมาณที่น้อยที่สุดได้
37 | ให้ตอบหมายเลขของถนนทุกสายด้วย
38 |
39 | \subsection*{\sectionfont\upshape Program Specification}
40 |
41 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
42 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
43 |
44 | \bigskip\noindent
45 | {\sectionfont\bfseries Input Format}
46 | \begin{itemize}
47 | \item บรรทัดที่ 1: มีจำนวนเต็มสองจำนวน $N$ และ $M$ คั่นด้วยช่องว่าง
48 | \item อีก $M$ บรรทัดถัดมา บรรทัดที่ $i+1$: จะมีจำนวนเต็มสามจำนวน $u_i, v_i, p_i$
49 | (คั่นด้วยช่องว่าง) ระบบข้อมูลของถนนหมายเลข $i$ ซึ่งเป็นถนนวิ่งทางเดียวจากเมืองหมายเลข $u_i$
50 | ไปยังเมืองหมายเลข $v_i$ และเก็บค่าผ่านทาง $p_i$ บาท
51 | \begin{lstlisting}
52 | N M
53 | u_1 v_1 p_1
54 | u_2 v_2 p_2 <%\SuppressNumber\AlternateNumber{...}%>
55 | <%\AlternateNumber{M+1}%>
56 | u_M v_M p_M <%\ReactivateNumber%>
57 | \end{lstlisting}
58 | \textbf{หมายเหตุ:} ข้อมูล Input จะรับประกันว่า
59 | มีเส้นทางที่เชื่อมจากเมืองหมายเลข $1$ ไปเมืองหมายเลข $N$ เสมอ
60 | \end{itemize}
61 |
62 | \medskip\noindent
63 | {\sectionfont\bfseries Output Format}
64 | \begin{itemize}
65 | \item บรรทัดที่ 1: จะต้องเขียนจำนวนเต็มสองจำนวน $D$ และ $K$ คั่นด้วยช่องว่างหนึ่งช่อง
66 | โดยที่ $D$ จะระบุปริมาณค่าผ่านทางที่ลดลงน้อยที่สุดที่เป็นไปได้ และ $K$ คือจำนวนถนนทั้งหมดที่สามารถล็อบบี้ให้ลดค่าผ่านทางได้
67 | \item อีก $K$ บรรทัดถัดมา แต่ละบรรทัดจะมีจำนวนเต็ม 1 จำนวน
68 | ซึ่งแต่ละจำนวนจะระบุหมายเลขถนนที่สามารถล็อบบี้ได้ นอกจากนั้น หมายเลขถนนทั้งหมดจะต้องเรียงจากน้อยไปมาก
69 |
70 | \textbf{หมายเหตุ:} ในกรณีที่บริษัทไม่สามารถใช้วิธีล็อบบี้ใด ๆ เพื่อเปิดเส้นทางใหม่ได้เลย
71 | ให้ตอบว่า $D=0$ และ $K=0$ เป็นกรณีพิเศษ
72 | \end{itemize}
73 |
74 | \subsection*{\sectionfont\upshape First Data Example}
75 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
76 | \toprule
77 | Example Input & Example Output \\
78 | \midrule
79 | \ttfamily\setstretch{0.8}
80 | 7 10 \newline
81 | 1 2 8 \newline
82 | 1 3 6 \newline
83 | 1 4 6 \newline
84 | 1 5 3 \newline
85 | 1 6 12 \newline
86 | 2 7 8 \newline
87 | 3 7 5 \newline
88 | 4 7 7 \newline
89 | 5 7 8 \newline
90 | 6 7 1 &
91 | \ttfamily\setstretch{0.8}
92 | 2 3 \newline
93 | 3 \newline
94 | 5 \newline
95 | 8 \\
96 | \bottomrule
97 | \end{tabular}
98 |
99 | \newpage\noindent
100 | \textbf{อธิบายตัวอย่างที่ 1:}
101 | \begin{itemize}
102 | \item จากตัวอย่างข้อมูลนี้ พบว่าจะมีเส้นทางลำเลียงที่ใช้ค่าผ่านทางรวมน้อยที่สุด 11 บาท
103 | ซึ่งมี 2 เส้นทาง ได้แก่ (1) เส้นทางที่ใช้ถนนหมายเลข $2 \,\&\, 7$
104 | และอีกเส้นทางที่ใช้ถนนหมายเลข $4 \,\&\, 9$
105 | \item หากเราล็อบบี้ให้มีการลดค่าผ่านทาง 2 บาท ให้แก่ถนน 1 สายในบรรดาถนน 3 สาย
106 | สายได้ก็ได้ (ซึ่งได้แก่ถนนหมายเลข $3$, $5$ และ $8$)
107 | แล้วจะทำให้มีเส้นทางลำเลียงสินค้าเส้นทางใหม่ที่ใช้เงินรวม 11 บาทเช่นกัน
108 | \end{itemize}
109 |
110 | \subsection*{\sectionfont\upshape Second Data Example}
111 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
112 | \toprule
113 | Example Input & Example Output \\
114 | \midrule
115 | \ttfamily\setstretch{0.8}
116 | 4 5 \newline
117 | 1 2 2 \newline
118 | 1 3 3 \newline
119 | 2 3 1 \newline
120 | 2 4 3 \newline
121 | 3 4 2 &
122 | \ttfamily\setstretch{0.8}
123 | 0 0 \\
124 | \bottomrule
125 | \end{tabular}
126 |
127 | \subsection*{\sectionfont\upshape Constraints}
128 |
129 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
130 | \begin{itemize}
131 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า จำนวนเมืองทั้งหมดจะสอดคล้องกับเงื่อนไข \\
132 | $3 \leq N \leq 50$ และจำนวนถนนทั้งหมดจะสอดคล้องกับเงื่อนไข $1 \leq M \leq 2,\!000$
133 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า จำนวนเมืองทั้งหมดจะสอดคล้องกับเงื่อนไข \\
134 | $3 \leq N \leq 100,\!000$ และจำนวนถนนทั้งหมดจะสอดคล้องกับเงื่อนไข $1 \leq M \leq 200,\!000$
135 | \item สำหรับทุก test cases จะมีเงื่อนไขว่า ค่าผ่านทางเริ่มต้นของถนนทุกสายจะสอดคล้องกับเงื่อนไข
136 | $0 \leq p_i \leq 5,\!000$
137 | \end{itemize}
138 |
--------------------------------------------------------------------------------
/questions03_coding/central_regional_polymerchain.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Polymer Chain}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | ในห้องปฏิบัติการวิจัยเคมีแห่งหนึ่ง มีการทดลอง Simulation การเปลี่ยนแปลงโครงสร้างสาย polymer
6 | ชื่อ polymer $K$ ซึ่งประกอบไปด้วยอะตอมหลากหลายชนิดเรียงตัวเป็นเส้นตรง
7 |
8 | ในคอมพิวเตอร์ เราจะแทนอะตอมแต่ละชนิดด้วยอักขระ \verb|"A"| ถึง \verb|"Z"|
9 | และเราจะแทน polymer \lstinline{K} ที่มีความยาว $N$ ด้วยสตริงที่ประกอบไปด้วยอักขระ
10 | \verb|"A"| ถึง \verb|"Z"| ความยาว $N$ ตัว
11 |
12 | ในห้องปฏิบัติการดังกล่าว ยังมีเครื่องจัดเรียง polymer ที่มีชื่อว่า
13 | \begin{center}
14 | \lstinline{manipulate_polymer_once(K[0...N-1], p)}
15 | \end{center}
16 | ซึ่งมี Specification ในการทำงานดังต่อไปนี้
17 |
18 | \begin{fullwidth}
19 | \vspace{2\baselineskip}
20 | \begin{quote}
21 | หาก input string \lstinline{K} ของฟังก์ชัน \lstinline{manipulate_polymer_once}
22 | คือลำดับของอักขระ \verb|K[0]|, \verb|K[1]|, \ldots, \verb|K[N-1]| ตามลำดับ
23 | และ \lstinline{p} คือ index ของสตริง \lstinline{K} โดยที่ \lstinline{0 <= p <= N-1}
24 | แล้ว ฟังก์ชันนี้จะ return ค่าสตริงซึ่งประกอบด้วยอักขระต่อไปนี้ตามลำดับ
25 | \[
26 | \underbrace{\text{\ttfamily K[p-1], K[p-2], \ldots, K[1], K[0],}}_\text{exists if $p > 0$}
27 | \text{\ttfamily K[p],}
28 | \underbrace{\text{\ttfamily K[N-1], K[N-2], \ldots, K[p+2], K[p+1]}}_\text{exists if $p < N-1$}
29 | \]
30 | ยกตัวอย่างเช่น ถ้า input ของ \lstinline{manipulate_polymer_once} ได้แก่
31 | \lstinline{K = "ASDFGHJKL"} และ \lstinline{p = 3}\;
32 | จะได้ output string เป็น \lstinline{"DSAFLKJHG"}\;
33 | สังเกตว่า \verb|F| จะอยู่ในตำแหน่งเดิมไม่เปลี่ยนแปลง แต่สตริงย่อยที่อยู่ข้างหน้าและข้างหลังจะถูกเรียงกลับหลัง
34 | \end{quote}
35 | \vspace{2\baselineskip}
36 | \end{fullwidth}
37 |
38 | ในการทำการทดลอง Simulation จริง เราจะนำ polymer สายหนึ่งมาจัดเรียงใหม่ไปเรื่อย ๆ
39 | อย่างต่อเนื่องเป็นจำนวน $M$ ครั้ง โดยปรับเปลี่ยน parameter ไปเรื่อย ๆ เช่น ถ้า polymer ตั้งต้นคือ
40 | \lstinline{K = "ASDFGHJKL"} และค่า parameter ของการจัดเรียง $M = 3$ ครั้งอย่างต่อเนื่องคือ
41 | \lstinline{p_1 = 3}, \lstinline{p_2 = 6}, \lstinline{p_3 = 0} เราจะได้ Polymer ผลลัพธ์เป็น
42 | \begin{center}
43 | \texttt{ASDFGHJKL → DSAFLKJHG → KLFASDJGH → KHGJDSAFL}
44 | \end{center}
45 |
46 | \subsection*{\sectionfont\upshape Problem Statement}
47 |
48 | จงเขียนโปรแกรมเพื่อทำ Simulation ของการจัดเรียง polymer สายหนึ่งด้วยลำดับของพารามิเตอร์ที่กำหนดให้
49 | แล้วหาว่า polymer ผลลัพธ์สุดท้ายมีหน้าตาเป็นอย่างไร
50 |
51 | \newpage
52 | \subsection*{\sectionfont\upshape Program Specification}
53 |
54 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
55 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
56 |
57 | \bigskip\noindent
58 | {\sectionfont\bfseries Input Format}
59 | \begin{itemize}
60 | \item บรรทัดที่ 1: มีจำนวนเต็มสองจำนวน $N$ และ $M$ คั่นด้วยช่องว่าง
61 | \item บรรทัดที่ 2: มีสตริงความยาว $N$ ซึ่งระบุข้อมูลสาย Polymer เริ่มต้นก่อนการทดลอง
62 | \item อีก $M$ บรรทัดถัดมา บรรทัดที่ $i+2$ จะมีค่า $p_i$ ซึ่งเป็น Parameter ของคำสั่งการจัดเรียง Polymer คำสั่งที่ $i$ ที่ต้องกระทำดับ Polymer $K$ ตามลำดับ
63 | \begin{lstlisting}
64 | N M
65 | K[0...N-1]
66 | p_1
67 | p_2 <%\SuppressNumber\AlternateNumber{...}%>
68 | <%\AlternateNumber{M+2}%>
69 | p_M <%\ReactivateNumber%>
70 | \end{lstlisting}
71 | \end{itemize}
72 |
73 | \medskip\noindent
74 | {\sectionfont\bfseries Output Format}\begin{itemize}
75 | \item คำตอบประกอบตัวสตริง 1 ตัว ซึ่งก็คือสาย Polymer สุดท้ายหลังจากจัดเรียง Polymer ตามคำสั่งทั้งหมด $M$ ตามที่กำหนดให้ใน input
76 | \end{itemize}
77 |
78 | \subsection*{\sectionfont\upshape Data Example}
79 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
80 | \toprule
81 | Example Input & Example Output \\
82 | \midrule
83 | \ttfamily\setstretch{0.8}
84 | 9 3 \newline
85 | ASDFGHJKL \newline
86 | 3 \newline
87 | 6 \newline
88 | 0 &
89 | \ttfamily\setstretch{0.8} KHGJDSAFL \\
90 | \bottomrule
91 | \end{tabular}
92 |
93 | \subsection*{\sectionfont\upshape Constraints}
94 |
95 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
96 | \begin{itemize}
97 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า ความยาว polymer จะสอดคล้องกับเงื่อนไข \\
98 | $1 \leq N \leq 300$
99 | และจำนวนครั้งที่เรียกใช้งานเครื่องจัดเรียง polymer
100 | สอดคล้องกับเงื่อนไข $0 \leq M \leq 30,\!000$
101 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า ความยาว polymer จะสอดคล้องกับเงื่อนไข \\
102 | $1 \leq N \leq 300,\!000$
103 | และจำนวนครั้งที่เรียกใช้งานเครื่องจัดเรียง polymer
104 | สอดคล้องกับเงื่อนไข $0 \leq M \leq 300,\!000$
105 | \end{itemize}
106 |
--------------------------------------------------------------------------------
/questions03_coding/national_findingpeepchan.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Finding Peep Chan}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | เด็กหญิงเกดเป็นเด็กน้อยแสนน่ารักที่เลี้ยงแมวเหมียวชื่อว่าปิ๊บจัง วันหนึ่งเจ้าปิ๊บจังหายไปเลยออกไปตามหา
6 | เด็กหญิงเกดได้เบาะแสมาว่าเจ้าปิ๊บจังไปติดอยู่ในถ้ำแห่งหนึ่ง ถ้ำมีลักษณะเป็น grid 2 มิติ
7 | แบ่งเป็นห้องขนาด $N \times M$ โดยห้องซ้ายบนสุดคือพิกัด $(1,1)$ และห้องขวาล่างสุดคือพิกัด $(N,M)$
8 |
9 | แต่ละห้องจะสามารถเดินไปมาหาสู่กันได้เฉพาะห้องที่ติดกันในทิศทาง บน ล่าง ซ้าย ขวา หรือก็คือ
10 | ห้อง $(x,y)$ สามารถเดินไปยังห้อง $(x-1,y)$, $(x+1,y)$, $(x,y-1)$ และ $(x,y+1)$
11 | นอกจากนี้ในถ้ำยังมีทางลัดอีก $K$ เส้นทาง โดยเส้นทางที่ $i$
12 | จะสามารถเดินทางไปมาหาสู่กันระหว่างห้อง $(x_{i1},y_{i1})$ และ $(x_{i2},y_{i2})$ ได้\;
13 | การเดินทางไปยังช่องที่ติดกันในทิศทาง บน ล่าง ซ้าย ขวา หรือ การใช้ทางลัด
14 | แต่ละครั้งจะใช้เวลาในการเดินทาง 1 วัน (ขอเรียกระยะการเดินของแมวใน 1 วันว่า 1 แมวเดิน)
15 |
16 | \begin{center}
17 | \bigskip
18 | \includegraphics[width=0.7\linewidth]{figures/coding_national_findingpeepchan_01.png}
19 | \end{center}
20 |
21 | จากรูปแสดงระยะทางในหน่วยแมวเดิน จากการเดินของแมวที่อยู่ที่ห้องตรงกลาง ลูกศรคือเส้นทางลัด
22 |
23 | เด็กหญิงเกดรู้สึกจนปัญญามากเพราะไม่รู้ว่าแมวอยู่ห้องไหนในถ้ำกันแน่ ดังนั้นจะถือว่า \\
24 | \uline{ตอนแรกแมวมีโอกาสที่จะอยู่ในแต่ละห้องด้วยความน่าจะเป็นที่เท่า ๆ กัน}
25 | (ซึ่งมีค่าเท่ากับ $\frac{1}{N \times M}$) เด็กหญิงเกดจึงไปร้องขอต่อเทพเจ้าให้ช่วยเหลือ
26 |
27 | \medskip
28 | เทพเจ้ามีพลังวิเศษ 2 อย่าง คือ
29 | \begin{itemize}
30 | \item \textbf{หยั่งรู้} --- เทพเจ้าจะเลือกห้องห้องหนึ่ง หลังจากนั้นพระเจ้าจะรู้ว่าแมวอยู่ห่างจากห้องที่เลือกเป็น
31 | ``ระยะทางที่ใกล้ที่สุด'' กี่แมวเดิน แต่ว่าสามารถใช้ได้วันละ 1 ครั้งเท่านั้น
32 | \item \textbf{ช่วยเหลือ} --- เทพเจ้าจะเลือกห้องห้องหนึ่งเพื่อช่วยเหลือแมว
33 | ถ้าแมวอยู่ในห้องที่เลือกจะถือว่าช่วยเหลือสำเร็จ แต่ว่าสามารถใช้ได้แค่ครั้งเดียวเท่านั้น
34 | \end{itemize}
35 |
36 | เนื่องจากถ้ำมีอากาศอยู่เบาบางมาก แมวจะสามารถมีชีวิตอยู่ได้แค่ 2 วัน
37 | เพราะฉะนั้นการช่วยเหลือแมวจะมีโอกาสแค่วันนี้กับพรุ่งนี้เท่านั้น
38 |
39 | \newpage
40 | เทพเจ้าตอบรับคำร้องขอของเด็กหญิงเกด และดำเนินการช่วยเหลือตามขั้นตอนต่อไปนี้
41 | \begin{enumerate}
42 | \item เทพเจ้าจะใช้พลัง \textbf{“หยั่งรู้”} เพื่อเลือกห้องห้องหนึ่งในถ้ำ
43 | \item เทพเจ้าจะพิจารณาว่า จะใช้พลัง \textbf{“ช่วยเหลือ”} ในวันนี้เลยหรือไม่
44 | แน่นอนว่าถ้าใช้แล้วจะไม่สามารถดำเนินการในข้อต่อไปได้
45 | เพราะไม่สามารถใช้พลัง \textbf{“ช่วยเหลือ”} ได้อีกต่อไป
46 | \item ในกรณีที่เทพเจ้าไม่ได้ใช้พลัง \textbf{“ช่วยเหลือ”} เทพเจ้าจะนอน 1 วันเพื่อพักผ่อน
47 | ในขณะที่เทพเจ้านอนพัก แมวจะเคลื่อนที่ 1 ครั้ง
48 | โดยการเคลื่อนที่นี้แมวจะสามารถเดินไปยังห้องที่ติดกันหรือห้องที่มีทางลัดไปหากันได้
49 | โดย\uline{แมวจะเดินไปยังห้องที่ไปได้ทั้งหมดด้วย} \uline{โอกาสที่เท่าๆกัน}
50 | \item ในวันถัดไป เทพเจ้าก็จะใช้พลัง \textbf{“หยั่งรู้”} อีกครั้ง
51 | \item เทพเจ้าก็จะใช้พลัง \textbf{“ช่วยเหลือ”} เพราะว่าเป็นโอกาสสุดท้ายที่จะช่วยเหลือแมวแล้ว
52 | \end{enumerate}
53 |
54 | \subsection*{\sectionfont\upshape Problem Statement}
55 |
56 | เทพเจ้าอยากทราบว่า ความน่าจะเป็นที่มากที่สุดที่เป็นไปได้ที่จะช่วยเหลือแมวได้สำเร็จเป็นเท่าไหร่
57 | ถ้าดำเนินการช่วยเหลืออย่าง optimal ที่สุด
58 |
59 | \subsection*{\sectionfont\upshape Program Specification}
60 |
61 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
62 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
63 |
64 | \bigskip\noindent
65 | {\sectionfont\bfseries Input Format}
66 | \begin{itemize}
67 | \item บรรทัดแรกประกอบด้วยจำนวนเต็ม $N, M$ แทนขนาดของถ้ำ และ K แทนจำนวนเส้นทางลัด
68 | \item K บรรทัดถัดมา บรรทัดที่ $i$ จะประกอบด้วย จำนวนเต็ม 4 จำนวน
69 | $x_{i1}$, $y_{i1}$, $x_{i2}$ และ $y_{i2}$ คั่นด้วยช่องว่าง ซึ่งระบุเส้นทางลัดเส้นที่ $i$
70 | \begin{lstlisting}
71 | N M K
72 | x_{1,1} y_{1,1} x_{1,2} y_{1,2}
73 | x_{2,1} y_{2,1} x_{2,2} y_{2,2} <%\SuppressNumber\AlternateNumber{...}%>
74 | <%\AlternateNumber{K+1}%>
75 | x_{K,1} y_{K,1} x_{K,2} y_{K,2} <%\ReactivateNumber%>
76 | \end{lstlisting}
77 | \textbf{หมายเหตุ:} รับประกันว่า $1 \leq x_{i1}, x_{i2} \leq N$ และ
78 | $1 \leq y_{i1},y_{i2} \leq M$ และจะไม่มีเส้นทางลัดซ้ำกัน และไม่มีทางลัดของห้องที่อยู่ติดกัน
79 | \end{itemize}
80 |
81 | \medskip\noindent
82 | {\sectionfont\bfseries Output Format}
83 | \begin{itemize}
84 | \item ตอบเป็นจำนวนจริง 1 จำนวน แทนความน่าจะเป็นที่มากที่สุดที่เป็นไปได้ของการช่วยเหลือแมว
85 | ถ้าเทพเจ้าทำการช่วยเหลืออย่าง Optimal ที่สุด \\
86 | (\textbf{หมายเหตุ:} คำตอบจะถูกต้องถ้าคาดเคลื่อนไม่มากกว่าคำตอบจริงเกิน $10^{-6}$)
87 | \end{itemize}
88 |
89 | \newpage
90 | \subsection*{\sectionfont\upshape First Data Example}
91 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
92 | \toprule
93 | Example Input & Example Output \\
94 | \midrule
95 | \ttfamily\setstretch{0.8}
96 | 2 2 1 \newline
97 | 1 1 2 2 &
98 | \ttfamily\setstretch{0.8}
99 | 0.9166666667 \\
100 | \bottomrule
101 | \end{tabular}
102 |
103 | \medskip\noindent
104 | \textbf{อธิบายตัวอย่างที่ 1:} จากตัวอย่างของข้อมูลนำเข้าข้างต้น สามารถแสดงให้เห็นตามรูปที่ปรากฏทางด้านข้าง
105 | โดยที่ลูกศรแสดงเส้นทางลัดระหว่างห้องสองห้อง
106 | \marginnote{%
107 | \centering
108 | \includegraphics[width=0.7\linewidth]{figures/coding_national_findingpeepchan_02.png}
109 | }
110 |
111 | หนึ่งในการวิธีช่วยเหลือที่ optimal ขอเทพเจ้ามีดังต่อไปนี้
112 | \begin{enumerate}
113 | \item วันแรก ใช้พลัง \textbf{“หยั่งรู้”} ที่ห้อง $(1,2)$
114 | \begin{enumerate}
115 | \item ความน่าจะเป็น $\frac{1}{4}$ ที่ระยะทางที่ใกล้ที่สุด
116 | จะเป็น $0$ แมวจะอยู่ที่ห้อง $(1,2)$ \\
117 | กรณีนี้สามารถใช้พลัง \textbf{“ช่วยเหลือ”} เพื่อช่วยแมวได้ทันที
118 | \item ความน่าจะเป็น $\frac{2}{4}$ ที่ระยะทางที่ใกล้ที่สุด
119 | จะเป็น 1 แมวอาจจะอยู่ที่ห้อง $(1,1)$ \\
120 | หรือ $(2,2)$ ก็ได้\; กรณีนี้ควรรอวันที่ 2
121 | \item ความน่าจะเป็น $\frac{1}{4}$ ที่ระยะทางที่ใกล้ที่สุด
122 | จะเป็น 2 แมวจะอยู่ที่ห้อง $(2,1)$ \\
123 | กรณีนี้สามารถใช้พลัง \textbf{“ช่วยเหลือ”} เพื่อช่วยแมวได้ทันที
124 | \end{enumerate}
125 | \item จากข้อ 1{\hrsp}(b) ระหว่างวันในขณะที่เทพเจ้านอนพัก การเคลื่อนที่ของแมวเป็นดังนี้
126 | \begin{itemize}
127 | \item ความน่าจะเป็นที่แมวจะเดินไปห้อง $(1,2)$ คือ
128 | $\frac{2}{4}\times\frac{1}{3}=\frac{2}{12}$ \\
129 | ← เดินจาก $(1,1)$ หรือ $(2,2)$
130 | \item ความน่าจะเป็นที่แมวจะเดินไปห้อง $(1,1)$ คือ
131 | $\frac{1}{4}\times\frac{1}{3}=\frac{1}{12}$ ← เดินจาก $(2,2)$
132 | \item ความน่าจะเป็นที่แมวจะเดินไปห้อง $(2,2)$ คือ
133 | $\frac{1}{4}\times\frac{1}{3}=\frac{1}{12}$ ← เดินจาก $(1,1)$
134 | \item ความน่าจะเป็นที่แมวจะเดินไปห้อง $(2,1)$ คือ
135 | $\frac{2}{4}\times\frac{1}{3}=\frac{1}{12}$ \\
136 | ← เดินจาก $(1,1)$ หรือ $(2,2)$
137 | \end{itemize}
138 | \item วันถัดมาวันที่ ใช้พลัง “หยั่งรู้” ที่ห้อง $(1,2)$ เช่นเดิม
139 | \begin{enumerate}
140 | \item ความน่าจะเป็น $\frac{2}{12}$ ที่ระยะทางที่ใกล้ที่สุดจะเป็น 0
141 | แมวจะอยู่ที่ห้อง $(1,2)$ \\
142 | กรณีนี้สามารถชใช้พลัง \textbf{“ช่วยเหลือ”} แมวได้แน่นอน
143 | \item ความน่าจะเป็น $\frac{2}{12}$ ที่ระยะทางที่ใกล้ที่สุดจะเป็น 2
144 | แมวจะอยู่ที่ห้อง $(2,1)$ \\
145 | กรณีนี้สามารถใช้พลัง \textbf{“ช่วยเหลือ”} แมวได้แน่นอน
146 | \item ความน่าจะเป็น $\frac{1}{12}+\frac{1}{12}=\frac{2}{12}$
147 | ที่ระยะทางที่ใกล้ที่สุดจะเป็น 1
148 | แมวจะอาจจะอยู่ที่ห้อง $(1,1)$ หรือ $(2,2)$ ก็ได้ \\
149 | กรณีนี้ การเลือกห้องใดห้องหนึ่งเพื่อใช้พลัง \textbf{“ช่วยเหลือ”}
150 | จะมีโอกาสช่วยแมวสำเร็จด้วยความน่าจะเป็น $\frac{2}{12} \times \frac{1}{2}=\frac{1}{12}$
151 | \end{enumerate}
152 | \item สรุปว่า ความน่าจะเป็นที่เทพเจ้าจะสามารถช่วยเหลือแมวได้ ตามข้อ 1{\hrsp}(a), 1{\hrsp}(c),
153 | 3{\hrsp}(a), 3{\hrsp}(b) และ 3{\hrsp}(c) คือ
154 | \[
155 | \frac{1}{4} + \frac{1}{4} + \frac{2}{12} + \frac{2}{12} + \frac{1}{12}
156 | = \frac{11}{12} \approx 0.9166666667
157 | \]
158 | \end{enumerate}
159 |
160 |
161 | \subsection*{\sectionfont\upshape Second Data Example}
162 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
163 | \toprule
164 | Example Input & Example Output \\
165 | \midrule
166 | \ttfamily\setstretch{0.8}
167 | 3 3 3 \newline
168 | 3 1 1 2 \newline
169 | 3 1 2 3 \newline
170 | 1 2 3 1 &
171 | \ttfamily\setstretch{0.8}
172 | 0.7259259259 \\
173 | \bottomrule
174 | \end{tabular}
175 |
176 | \subsection*{\sectionfont\upshape Constraints}
177 |
178 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
179 | \begin{itemize}
180 | \item test cases ชุดเล็กจะมีเงื่อนไข ขนาดของถ้ำสอดคล้องกับเงื่อนไข
181 | $1 \leq N,M \leq 20$ และ $N \times M \leq 200$
182 | และจำนวนเส้นทางลัดสอดคล้องกับเงื่อนไข $1 \leq K \leq 100$
183 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า ขนาดของถ้ำสอดคล้องกับเงื่อนไข
184 | $1 \leq N,M \leq 20$ และจำนวนเส้นทางลัดสอดคล้องกับเงื่อนไข $1 \leq K \leq 70,000$
185 | \end{itemize}
186 |
--------------------------------------------------------------------------------
/questions03_coding/national_interceptmeteor.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Intercept Meteor}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | องค์การบริหารการบินและอวกาศแห่งโลกได้ตรวจพบอุกกาบาตขนาดใหญ่ที่กำลังพุ่งชนโลก
6 | จึงได้เตรียมแผนการรับมือโดยการส่งนักขุดเจาะฝีมือดีขึ้นไปวางระเบิดที่แกนของอุกกาบาตเพื่อระเบิดอุกกาบาตออกเป็นชิ้นเล็ก ๆ
7 | ก่อนจะตกลงสู่พื้นโลก จากการคาดการณ์ เศษอุกกาบาตส่วนใหญ่จะตกลงสู่ทะเล
8 | มีเพียงเกาะโคะเกาะเดียวเท่านั้นที่มีคนอาศัยอยู่และได้รับผลกระทบจากเศษอุกกาบาต
9 |
10 | เพื่อปกป้องเกาะโคะที่มีอารยธรรมโบราณอันมีคุณค่า
11 | องค์การบริหารการบินและอวกาศแห่งโลกจึงได้ติดตั้งฐานยิงจรวดมิสไซล์ไว้ที่เกาะโคะเพื่อยิงเศษอุกกาบาตก่อนจะตกถึงพื้น
12 | ข้อเสียของการใช้จรวดมิสไซล์คือ การยิงเศษอุกกาบาตแต่ละครั้งจะสร้างมลพิษสู่ชั้นบรรยากาศเป็นจำนวนมาก
13 | องค์การบริหารการบินและอวกาศแห่งโลกจึงต้องการยิงเศษอุกกาบาตให้น้อยที่สุด
14 | โดยจะยิงเฉพาะเศษอุกกาบาตที่มีจุดตกอยู่บนพื้นเกาะโคะเท่านั้น
15 |
16 | ความพิเศษของเกาะโคะคือมีลักษณะเป็น convex polygon
17 | (เป็นรูปหลายเหลี่ยม และทุกคู่จุดใด ๆ บนเกาะสามารถเดินเป็นเส้นตรงถึงกันได้โดยไม่มีทะเลมาขวาง)
18 |
19 | \subsection*{\sectionfont\upshape Problem Statement}
20 |
21 | องค์การบริหารการบินและอวกาศแห่งโลกต้องการให้คุณเขียนโปรแกรมช่วยคำนวนว่าจากจุดตกของเศษอุกกาบาตแต่ละลูก
22 | มีลูกไหนตกบนพื้นเกาะโคะ, ตกตรงขอบเกาะโคะ และ ตกนอกเกาะโคะบ้าง
23 |
24 | ให้พิจารณาเฉพาะ\uline{จุด}ตกเท่านั้น ไม่ต้องสนใจขนาดของเศษอุกกาบาต
25 |
26 | \subsection*{\sectionfont\upshape Program Specification}
27 |
28 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
29 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
30 |
31 | \bigskip\noindent
32 | {\sectionfont\bfseries Input Format}
33 | \begin{itemize}
34 | \item บรรทัดแรก เป็นจำนวนเต็มบวก $N$ แทนจำนวนมุมของ convex polygon $C$ ที่แสดงขอบเขตของเกาะโคะ
35 | \item $N$ บรรทัดต่อมา แต่ละบรรทัดเป็นจำนวนเต็ม $x$ $y$ คั่นด้วยช่องว่าง
36 | แทนพิกัดจุดมุมแต่ละจุดของ C เรียงตามเข็มนาฬิกา โดยเริ่มจากจุดที่มีค่า $x$ น้อยที่สุด
37 | หากมีจุดที่มีค่า $x$ น้อยที่สุดมากกว่าหนึ่งจุดจะเริ่มต้นจากจุดที่มีค่า $y$ น้อยที่สุด
38 | (รับประกันว่าไม่มีพิกัดใดซ้ำกันเลย และ ไม่มี 3 จุดมุมใดๆที่เรียงต่อเนื่องกันเป็นเส้นตรง)
39 | \item บรรทัดต่อมา เป็นจำนวนเต็มบวก $K$ แทนจำนวนเศษอุกกาบาตที่ต้องการตรวจสอบ
40 | \item $K$ บรรทัดต่อมา แต่ละบรรทัดเป็นจำนวนเต็ม $x$ $y$ คั่นด้วยช่องว่าง
41 | แทนพิกัดของจุดตกของเศษอุกกาบาตที่ต้องการตรวจสอบแต่ละลูก
42 | \end{itemize}
43 |
44 | \medskip\noindent
45 | {\sectionfont\bfseries Output Format}
46 | สำหรับเศษอุกกาบาตที่ต้องการตรวจสอบแต่ละลูก ให้แสดงข้อความในหนึ่งบรรทัด โดยข้อความจะเป็น
47 |
48 | \newpage
49 | \begin{fullwidth}
50 | \begin{itemize}[itemsep=0pt]
51 | \item \lstinline|"Inside"| หากจุดตกอยู่ภายในเกาะโคะ หรือ
52 | \item \lstinline|"Outside"| หากจุดตกอยู่ภายนอกเกาะโคะ หรือ
53 | \item \lstinline|"On the boundary"| หากจุดตกอยู่บนเส้นรอบรูปของเกาะโคะพอดี
54 | (อยู่บนขอบหรืออยู่ที่จุดมุมก็ได้)
55 | \end{itemize}
56 | \end{fullwidth}
57 |
58 | \subsection*{\sectionfont\upshape Data Example}
59 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
60 | \toprule
61 | Example Input & Example Output \\
62 | \midrule
63 | \ttfamily\setstretch{0.8}
64 | 7 \newline
65 | -5 1 \newline
66 | 0 6 \newline
67 | 6 10 \newline
68 | 10 11 \newline
69 | 10 9 \newline
70 | 5 4 \newline
71 | 0 2 \newline
72 | 6 \newline
73 | 0 5 \newline
74 | -4 9 \newline
75 | 5 4 \newline
76 | 10 10 \newline
77 | 10 3 \newline
78 | 5 5 &
79 | \ttfamily\setstretch{0.8}
80 | Inside \newline
81 | Outside \newline
82 | On the boundary \newline
83 | On the boundary \newline
84 | Outside \newline
85 | Inside \\
86 | \bottomrule
87 | \end{tabular}
88 |
89 | \medskip\noindent
90 | \textbf{อธิบายตัวอย่าง:} รูปล่างของเกาะโคะมีลักษณะดังที่ปรากฏทาง\ifpageodd{ขวา}{ซ้าย}มือ\;
91 | นอกจากนั้นมี 6 คำถามดังต่อไปนี้
92 | \marginnote{
93 | \includegraphics[width=0.96\linewidth]{figures/coding_national_interceptmeteor.png}
94 | }
95 | \begin{itemize}[itemsep=0pt]
96 | \item คำถามแรก จุด (0, 5) อยู่ภายใน C ตอบว่า \lstinline|"Inside"|
97 | \item คำถามที่สอง จุด (-4, 9) อยู่ภายนอก C ตอบว่า \lstinline|"Outside"|
98 | \item คำถามที่สาม จุด (5, 4) เป็นจุดมุม ตอบว่า \lstinline|"On the boundary"|
99 | \item คำถามที่สี่ จุด (10, 10) อยู่บนขอบ ตอบว่า \lstinline|"On the boundary"|
100 | \item คำถามที่ห้า จุด (10, 3) อยู่ภายนอก C ตอบว่า \lstinline|"Outside"|
101 | \item คำถามที่หก จุด (5, 5) อยู่ภายใน C ตอบว่า \lstinline|"Inside"|
102 | \end{itemize}
103 |
104 | \subsection*{\sectionfont\upshape Constraints}
105 |
106 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
107 | \begin{itemize}
108 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า จำนวนมุมของ convex polygon
109 | ที่แสดงขอบเขตของเกาะโคะสอดคล้องกับเงื่อนไข $3 \leq N \leq 1,\!000$
110 | และจำนวนเศษอุกกาบาตที่ต้องการตรวจสอบสอดคล้องกับเงื่อนไข $1 \leq K \leq 1,\!000$
111 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า จำนวนมุมของ convex polygon
112 | ที่แสดงขอบเขตของเกาะโคะสอดคล้องกับเงื่อนไข $3 \leq N \leq 10^5$
113 | และจำนวนเศษอุกกาบาตที่ต้องการตรวจสอบสอดคล้องกับเงื่อนไข $1 \leq K \leq 10^5$
114 | \item สำหรับทุก test cases จะมีเงื่อนไขว่า พิกัดจุดมุมของ convex polygon
115 | ที่แสดงขอบเขตของเกาะโคะ และ พิกัดจุดตกของเศษอุกกาบาตสอดคล้องกับเงื่อนไข \\
116 | $-10^9 \leq x,y \leq 10^9$
117 | \end{itemize}
118 |
--------------------------------------------------------------------------------
/questions03_coding/national_rotatesort.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Rotate Sort (Optimization Problem)}
2 |
3 | \begin{quote}
4 | \em
5 | \vphantom{~}\llap{\adfdownleafleft\;}โจทย์ Coding
6 | ข้อนี้ ปรากฏในการแข่งขัน \techjam\ รอบชิงชนะเลิศระดับประเทศ
7 | โดยเป็นโจทย์ที่ผู้เข้าแข่งขันจะต้อง optimize เพื่อหาคำตอบที่ดีที่สุดในบรรดาผู้เข้าแข่งขันทั้งหมด
8 | หากโปรแกรมของผู้เข้าแข่งขันให้ผลลัพธ์ที่ดีมากเท่าใด ก็จะยิ่งมีโอกาสได้คะแนนสูงมากขึ้นเท่านั้น
9 |
10 | กติการที่ปรากฏในส่วนของ Submission and Scoring นั้นมีนัยยะสำคัญเฉพาะภายในการแข่งขันดังกล่าวเท่านั้น
11 | โปรดใช้เนื้อหาดังกล่าวเพื่อการอ้างอิงเท่านั้น
12 | \end{quote}
13 |
14 | \subsection*{\sectionfont\upshape Background}
15 |
16 | กำหนดให้ operation ชื่อว่า \lstinline|rotate_3way| รับ input argument อยู่ 3 อย่าง ได้แก่
17 | \begin{itemize}
18 | \item array $A$ ของจำนวนเต็ม
19 | \item ดัชนี $p$ และ $q$ ภายใน array $A$ ซึ่ง $1 \leq p \leq q \leq |A|$ \\
20 | (เมื่อ $|A|$ คือความยาวของ array $A$)
21 | \end{itemize}
22 |
23 | เมื่อเรียกใช้งาน \lstinline|rotate_3way(A, p, q)| จะได้ output value เป็น array ที่มีลักษณะเป็นดังนี้
24 | \begin{fullwidth}
25 | \vspace*{-\baselineskip}
26 | \[
27 | \text{\ttfamily rotate\_3way(A, p, q)} =
28 | \left[
29 | \underbrace{\text{\ttfamily A[q+1], A[q+2], \ldots, A[N],}}_\text{can be empty}
30 | \text{\ttfamily A[p], A[p+1],\ldots,A[q],}
31 | \underbrace{\text{\ttfamily A[1], A[2], \ldots, A[p-1]}}_\text{can be empty}
32 | \right]
33 | \]
34 | \end{fullwidth}
35 |
36 | \noindent
37 | ยกตัวอย่างเช่น
38 | \begin{itemize}[itemsep=0pt]
39 | \item \lstinline{rotate_3way([5, 2, 1, 0], 2, 3) = [0, 2, 1, 5]}
40 | \item \lstinline{rotate_3way([5, 2, 1, 0], 2, 2) = [1, 0, 2, 5]}
41 | \item \lstinline{rotate_3way([5, 2, 1, 0], 1, 2) = [1, 0, 5, 2]}
42 | \item \lstinline{rotate_3way([5, 2, 1, 0], 1, 4) = [5, 2, 1, 0]}
43 | \end{itemize}
44 |
45 | \subsection*{\sectionfont\upshape Problem Statement}
46 |
47 | โจทย์ข้อนี้ โปรแกรมของผู้เข้าแข่งขันจะได้รับข้อมูลนำเข้าเป็น array $X$ ของจำนวนเต็มที่ไม่เรียงลำดับ
48 | กำหนดให้ $N = |X|$ คือความยาวของ array $X$
49 |
50 | เป้าหมายของโปรแกรมของผู้เข้าแข่งขันคือ
51 | จะต้องเรียงลำดับจำนวนใน array $X$ โดยเรียกใช้งาน operation \lstinline|rotate_3way|
52 | เป็นจำนวนครั้งให้ได้น้อยที่สุดเท่าที่ผู้เข้าแข่งขันสามารถทำได้
53 |
54 | กล่าวคือ เมื่อโปรแกรมของผู้เข้าแข่งขันได้รับข้อมูล array $X$ แล้วจะต้องระบุว่าจะเรียกใช้งาน
55 | \lstinline|rotate_3way| ทั้งสิ้นกี่ครั้ง และในแต่ละครั้ง จะกำหนดค่าดัชนี $p$ และ $q$ เท่าใด
56 | ตามลำดับ
57 |
58 | สำหรับเกณฑ์การให้คะแนนในข้อนี้ โปรดดูหัวข้อ Submission and Scoring
59 |
60 | \subsection*{\sectionfont\upshape Program Specification}
61 |
62 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
63 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
64 |
65 | \bigskip\noindent
66 | {\sectionfont\bfseries Input Format}
67 | \begin{itemize}
68 | \item บรรทัดที่ 1: จะมีจำนวนเต็มหนึ่งจำนวน ระบุ $N$ ซึ่งเป็นความยาวของ array $X$
69 | \item อีก $N$ บรรทัดถัดมา บรรทัดที่ $i+1$ จะระบุจำนวน $X[i]$ ของ array $X$
70 | \begin{lstlisting}
71 | N
72 | X[1]
73 | X[2] <%\SuppressNumber\AlternateNumber{...}%>
74 | <%\AlternateNumber{N+1}%>
75 | X[N] <%\ReactivateNumber%>
76 | \end{lstlisting}
77 | \end{itemize}
78 |
79 | \medskip\noindent
80 | {\sectionfont\bfseries Output Format}
81 | \begin{itemize}
82 | \item บรรทัดที่ 1: จะมีจำนวนเต็ม $K$ หนึ่งจำนวน ระบุจำนวนครั้งที่ operation \lstinline|rotate_3way|
83 | จะถูกเรียกใช้งาน
84 | \item อีก $K$ บรรทัดถัดมา บรรทัดที่ $j+1$ จะระบุจำนวนเต็มสองจำนวน $p_j$ และ $q_j$
85 | คั่นด้วยช่องว่ง ซึ่งเป็นดัชนี $p$ และ $q$ ของการเรียกใช้งาน operation \lstinline|rotate_3way|
86 | ครั้งที่ $j$
87 | \end{itemize}
88 |
89 | \subsection*{\sectionfont\upshape Data Example}
90 | \begin{tabular}{p{0.3\linewidth}p{0.3\linewidth}p{0.3\linewidth}}
91 | \toprule
92 | Example Input & Example Output A & Example Output B \\
93 | \midrule
94 | \ttfamily\setstretch{0.8}
95 | 4 \newline
96 | 5 \newline
97 | 2 \newline
98 | 1 \newline
99 | 0 &
100 | \ttfamily\setstretch{0.8}
101 | 3 \newline
102 | 2 2 \newline
103 | 2 2 \newline
104 | 3 4 &
105 | \ttfamily\setstretch{0.8}
106 | 4 \newline
107 | 2 4 \newline
108 | 2 4 \newline
109 | 3 3 \newline
110 | 3 3 \\
111 | \bottomrule
112 | \end{tabular}
113 |
114 | \medskip\noindent
115 | \textbf{อธิบายตัวอย่าง:} สังเกตว่าลำดับของ operation ที่แสดงในทั้งสองคำตอบข้างต้น
116 | สามารถทำให้ array $X$ เรียงลำดับได้ถูกต้อง แต่คำตอบ A ใช้จำนวน operation น้อยกว่า B
117 |
118 | \subsection*{\sectionfont\upshape Submission and Scoring}
119 |
120 | สำหรับโจทย์ข้อนี้ พึงทราบว่า test case แต่ละอันจะมีคะแนนเต็ม 18 คะแนน นอกจากนั้น
121 | คะแนนรวมตอนท้ายสำหรับโจทย์ข้อนี้จะคิดจากค่าเฉลี่ยของคะแนนจากแต่ละ test case
122 | จึงทำให้คะแนนรวมสูงสุดที่เป็นไปได้สำหรับข้อนี้คือ 18 คะแนน เช่นกัน
123 | (เศษทศนิยมของคะแนนจะถูกปัดทิ้งให้เหลือทศนิยม 6 ตำแหน่ง)
124 |
125 | \bigskip\noindent
126 | {\sectionfont\bfseries Minimum requirement} \\
127 | สำหรับ test case แต่ละอัน โปรแกรมของผู้เข้าแข่งขันจะถือว่าให้ผลลัพธ์ที่\uline{ถูกต้อง} ก็ต่อเมื่อ
128 | \begin{enumerate}
129 | \item โปรแกรมให้ผลลัพธ์ตรงกับ Program Specification ที่โจทย์กำหนดให้
130 | \item ผลลัพธ์ของโปรแกรมเรียกใช้งาน operation \lstinline|rotate_3way|
131 | ที่ทำให้ array $X$ เรียงลำดับจากน้อยไปมากได้ถูกต้อง
132 | \item ผลลัพธ์ของโปรแกรมเรียกใช้งาน operation \lstinline|rotate_3way| ไม่เกิน $100 N$ ครั้ง
133 | \end{enumerate}
134 |
135 | \noindent
136 | \textbf{\uline{หมายเหตุ:}} หากโปรแกรมของคุณให้ผลลัพธ์ไม่ถูกต้อง จะได้ 0 คะแนนทันที\newline
137 |
138 | \smallskip\noindent
139 | {\sectionfont\bfseries Scoring scheme for correct answers} \\
140 | เมื่อโปรแกรมของคุณให้ผลลัพธ์ที่ถูกต้อง กำหนดให้
141 |
142 | \begin{itemize}
143 | \item โปรแกรมของคุณเรียกใช้งาน operation \lstinline|rotate_3way|
144 | เป็นจำนวน $K$ ครั้งสำหรับ test case นี้
145 | \item ในบรรดาผู้เข้าแข่งขันทั้งหมด จำนวน operation ที่น้อยที่สุดที่มีผู้เข้าแข่งขันทำได้คือ $K^*$ ครั้ง
146 | สำหรับ test case เดียวกัน
147 | \end{itemize}
148 | แล้วคะแนนของคุณสำหรับ test case อันนี้จะคำนวณจากสูตรดังต่อไปนี้
149 | \[
150 | \begin{cases}
151 | 18 &\quad\text{if $K = K^*$} \\
152 | 6 + 9 \cdot\dfrac{K^*}{K} &\quad\text{if $K > K^*$}
153 | \end{cases}
154 | \]
155 |
156 | สังเกตว่าเมื่อโปรแกรมให้ผลลัพธ์ที่ถูกต้อง รับประกันว่าจะได้คะแนนอย่างน้อย 6 คะแนนสำหรับ test case นั้น ๆ\;
157 | และกำหนดให้เศษที่เกิดขึ้นจากการหาร จะถูกปัดทิ้งให้เหลือทศนิยม 6 ตำแหน่ง
158 |
159 | \subsection*{\sectionfont\upshape Constraints}
160 |
161 | แต่ละ test case จะมีเงื่อนไขดังต่อไปนี้
162 | \begin{itemize}
163 | \item ความยาวของ array $X$ จะสอดคล้องกับเงื่อนไข $2 \leq N \leq 100$
164 | \item จำนวนที่พบใน array $X$ จะอยู่ในช่วง $0$ ถึง $1000$ ซึ่งอาจมีบางจำนวนซ้ำกันได้
165 | \end{itemize}
166 |
--------------------------------------------------------------------------------
/questions03_coding/national_stablemolecule.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Stable Molecule}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | ในห้องปฏิบัติการวิจัยเคมีแห่งหนึ่ง\; คุณกุ้งกำลังศึกษาโครงสร้างของโมเลกุลชนิดหนึ่ง\;
6 | ซึ่งประกอบไปด้วยอะตอมหลากหลายชนิดมาประกอบกันด้วยพันธะที่เชื่อมระหว่างอะตอมบางคู่ จนมีโครงสร้างเป็นกราฟต้นไม้
7 |
8 | กล่าวคือโครงสร้างโมเลกุลนี้จะประกอบด้วยอะตอมทั้งสิ้น $N$ ชนิด ชนิดละ 1 อนุภาค (เรียกสั้น ๆ ว่า “ลูก”)
9 | และมีพันธะทั้งสิ้น $N-1$ พันธะที่เชื่อมอะตอมเหล่านี้เข้าด้วยกัน
10 | (เราจะเรียกอะตอมแต่ละลูกว่าลูกที่ $i$ สำหรับ $i = 1, 2, \ldots, N$)
11 |
12 | คุณกุ้งสามารถกำหนดค่ามวลของอะตอมแต่ละลูกได้ โดยที่มวลของอะตอมลูกที่ $i$ จะกำหนดด้วยตัวแปร $m_i$
13 | ซึ่งเป็นจำนวนเต็มบวก กล่าวคือมีเงื่อนไขว่า $m_i \geq 1$
14 |
15 | โครงสร้างโมเลกุลนี้จะ \textbf{“เสถียร”} ก็ต่อเมื่อ แรงดึงดูดระหว่างอะตอม 2 ลูกที่เป็นพันธะต่อกันจะมีค่าไม่เกิน $P$
16 | โดยแรงดึงดูดระหว่างมวลสามารถคำนวณได้จากผลคูณของมวลของอะตอมแต่ละลูก (นั่นแปลว่า $m_u \times m_v \leq P$ สำหรับทุกคู่อะตอม $u$ และ $v$ ที่มีพันธะต่อกัน)
17 |
18 | \bigskip\noindent
19 | \textbf{\uline{ตัวอย่าง}}
20 | เมื่อพิจารณาโครงสร้างโมเลกุลที่เกิดจากอะตอม 4 ลูกที่เชื่อมกันดังรูปทาง\ifpageodd{ขวา}{ซ้าย}
21 | และกำหนดให้ $P=12$ แล้วพบว่าโครงสร้างโมเลกุลรูปบนจะเสถียร แต่โครงสร้างอันล่างจะไม่เสถียร
22 | \marginnote[-15\baselineskip]{%
23 | \centering
24 | \includegraphics[width=0.97\linewidth]{figures/coding_national_stablemolecule_01.png}
25 |
26 | \bigskip\bigskip
27 | \includegraphics[width=0.97\linewidth]{figures/coding_national_stablemolecule_02.png}
28 | }
29 |
30 | \subsection*{\sectionfont\upshape Problem Statement}
31 |
32 | จงเขียนโปรแกรมเพื่อรับข้อมูลที่กำหนดโครงสร้างโมเลกุล และค่าขีดจำกัดสูงสุดของแรงดึดดูดระหว่างอะตอม $P$
33 | แล้วหาว่าคุณกุ้งจะสามารถกำหนดค่ามวลให้แก่อะตอมแต่ละลูกให้แตกต่างกันได้ทั้งหมดกี่รูปแบบ โดยที่โมเลกุลจะยังเสถียรอยู่
34 |
35 | \subsection*{\sectionfont\upshape Program Specification}
36 |
37 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
38 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
39 |
40 | \bigskip\noindent
41 | {\sectionfont\bfseries Input Format}
42 | \begin{itemize}
43 | \item บรรทัดที่ 1: มีจำนวนเต็มสองจำนวน $N$ และ $P$ คั่นด้วยช่องว่าง
44 | \item อีก $N-1$ บรรทัดถัดมา บรรทัดที่ $j+1$ จะมีจำนวนเต็ม $u_j$ และ $v_j$
45 | คั่นด้วยช่องว่าง ซึ่งระบุว่ามีพันธะระหว่างอะตอมลูกที่ $u_j$ และอะตอมลูกที่ $v_j$
46 | \begin{lstlisting}
47 | N P
48 | u_1 v_1
49 | u_2 v_2 <%\SuppressNumber\AlternateNumber{...}%>
50 | <%\AlternateNumber{N+1}%>
51 | u_N v_N <%\ReactivateNumber%>
52 | \end{lstlisting}
53 | \textbf{หมายเหตุ:} กำหนดให้ $1 \leq u_j, v_j \leq N$ และ $u_j \neq v_j$
54 | \end{itemize}
55 |
56 | \medskip\noindent
57 | {\sectionfont\bfseries Output Format}
58 | \begin{itemize}
59 | \item คำตอบประกอบด้วยจำนวนเต็ม 1 ตัว
60 | ระบุจำนวนรูปแบบของโมเลกุลที่คุณกุ้งสามารถกำหนดมวลให้อะตอมแต่ละลูกได้
61 | โดยคำตอบจะต้องอยู่ในรูปของเศษที่เกิดจากการหารด้วย $1,\!000,\!000,\!007$
62 | \end{itemize}
63 |
64 | \subsection*{\sectionfont\upshape First Data Example}
65 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
66 | \toprule
67 | Example Input & Example Output \\
68 | \midrule
69 | \ttfamily\setstretch{0.8}
70 | 4 2 \newline
71 | 1 2 \newline
72 | 2 3 \newline
73 | 4 2 &
74 | \ttfamily\setstretch{0.8}
75 | 9 \\
76 | \bottomrule
77 | \end{tabular}
78 |
79 | \medskip\noindent
80 | \textbf{อธิบายตัวอย่างที่ 1:} เราสามารถแจกแจงรูปแบบของการกำหนดมวลให้อะตอมแต่ละลูกในโมเลกุลได้ดังนี้
81 |
82 | \begin{fullwidth}
83 | \begin{center}
84 | \bigskip
85 | \includegraphics[width=0.9\linewidth]{figures/coding_national_stablemolecule_03.png}
86 | \end{center}
87 | \end{fullwidth}
88 |
89 | \subsection*{\sectionfont\upshape Second Data Example}
90 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
91 | \toprule
92 | Example Input & Example Output \\
93 | \midrule
94 | \ttfamily\setstretch{0.8}
95 | 5 3 \newline
96 | 4 2 \newline
97 | 3 2 \newline
98 | 1 3 \newline
99 | 5 3 &
100 | \ttfamily\setstretch{0.8}
101 | 51 \\
102 | \bottomrule
103 | \end{tabular}
104 |
105 | \subsection*{\sectionfont\upshape Constraints}
106 |
107 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
108 | \begin{itemize}
109 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า ค่าขีดจำกัดสูงสุดของแรงดึดดูดระหว่างอะตอมจะสอดคล้องกับเงื่อนไข $1 \leq P \leq 10^3$
110 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า ค่าขีดจำกัดสูงสุดของแรงดึดดูดระหว่างอะตอมจะสอดคล้องกับเงื่อนไข $1 \leq P \leq 10^9$
111 | \item สำหรับทุก test cases จะมีเงื่อนไขว่า จำนวนของอะตอมจะสอดคล้องกับเงื่อนไข $1 \leq N \leq 1,\!000$
112 | \end{itemize}
113 |
--------------------------------------------------------------------------------
/questions03_coding/south_regional_islandcounting.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Island Counting}
2 |
3 | \subsection*{\sectionfont\upshape Background}
4 |
5 | ในเกมย้อนยุคเกมหนึ่ง มีการวาดแผนที่ด้วย ASCII Art โดยประกอบไปด้วยอักขระ ASCII
6 | ที่เรียงตัวกันเป็นสี่เหลี่ยมผืนผ้าจำนวน $R$ แถว แถวละ $C$ ตัว
7 |
8 | อักขระแต่ละตัวจะแทนช่อง 1 ช่องและมีค่าได้ 2 แบบ ได้แก่
9 | \begin{itemize}
10 | \item ผืนดิน ซึ่งเราจะขอแทนด้วย `\verb|#|'
11 | \item ผืนน้ำ ซึ่งเราจะขอแทนด้วย `\verb|.|'
12 | \end{itemize}
13 |
14 | นอกจากนี้เราจะสมมติว่า รอบนอกสี่เหลี่ยมผืนผ้านี้จะ\uline{มีแต่น้ำทะเล}อันกว้างใหญ่ไพศาลและ\uline{ไม่มีผืนดิน}อยู่เลย
15 |
16 | \bigskip\noindent
17 | \textbf{\uline{ตัวอย่าง}}* นี่คือแผนที่ตัวอย่าง ซึ่งมีขนาด $R = {6}$ และ $C = {18}$
18 | \begin{center}
19 | \vspace{0.25\baselineskip}
20 | \begin{centervrb}{18}
21 | \begin{plainvrb}
22 | ................##
23 | ..#####...##......
24 | .##...##..##...###
25 | .#..#..#.......#..
26 | .#....##..#.#..#.#
27 | .######....#...#.#
28 | \end{plainvrb}
29 | \end{centervrb}
30 | \vspace{0.25\baselineskip}
31 | \end{center}
32 |
33 | \subsection*{\sectionfont\upshape What is an island?}
34 | จากแผนที่ในลักษณะข้างต้น เรานิยามภูมิประเทศทีของเกาะดังนี้%
35 |
36 | \begin{itemize}
37 | \item หากเราเริ่มต้นจากตำแหน่งผืนดินใด ๆ ในแผนที่ แล้วสามารถเดินทางไปยังผืนดินอื่น~ๆ
38 | ข้างเคียงได้ด้วยการเดิน ขึ้น--ลง--ซ้าย--ขวา ไปเรื่อย~ๆ ได้
39 | ให้ถือว่าผืนดินที่เดินไปถึงทั้งหมดเหล่านั้นเป็นส่วนหนึ่งของเกาะเดียวกัน
40 | \item มากไปกว่านั้น จากการเดินข้างต้น หากเราเริ่มเดินจนวกกลับมาที่ผืนดินเริ่มต้น
41 | ให้ถือว่าบริเวณที่ถูกรายล้อมด้วยการเดินข้างต้นเป็นส่วนหนึ่งของเกาะเดียวกันเช่นกัน
42 | \begin{itemize}[before*=\small]
43 | \item สังเกตว่าอาจมีทะเลสาบที่ถูกรายล้อมด้วยผืนดินของเกาะเกาะหนึ่ง
44 | ซึ่งผืนน้ำดังกล่าวจะถูกนับไปส่วนหนึ่งของเกาะนั้นด้วย
45 | \item ไม่เพียงแค่นั้น ผืนดินที่ซ้อนอยู่ภายในทะเลสาบดังกล่าว
46 | ก็ยังถือว่าเป็นส่วนของเกาะภายนอกด้วย ไม่นับเป็นเกาะแยกต่างหาก
47 | \end{itemize}
48 | \end{itemize}
49 |
50 | \bigskip\noindent
51 | \textbf{\uline{ตัวอย่าง}}* จากแผนที่ตัวอย่างเดิมข้างต้น
52 | เราสามารถเขียนใหม่โดยส่วนของเกาะเดียวกันเขียนด้วยตัวอักษรเดียวกันได้ดังนี้
53 | (สังเกตได้ว่าแผนที่นี้จะมีเกาะทั้งสิ้น 8 เกาะ)
54 | \begin{center}
55 | \vspace{0.25\baselineskip}
56 | \begin{centervrb}{18}
57 | \begin{plainvrb}
58 | ................AA
59 | ..BBBBB...CC......
60 | .BBBBBBB..CC...DDD
61 | .BBBBBBB.......D..
62 | .BBBBBBB..E.F..D.G
63 | .BBBBBB....H...D.G
64 | \end{plainvrb}
65 | \end{centervrb}
66 | \vspace{0.25\baselineskip}
67 | \end{center}
68 |
69 | \subsection*{\sectionfont\upshape Problem Statement}
70 |
71 | จากแผนที่ภายในเกมที่กำหนดให้ มีเกาะทั้งสิ้นกี่เกาะ?
72 |
73 | \subsection*{\sectionfont\upshape Program Specification}
74 |
75 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
76 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
77 |
78 | \bigskip\noindent
79 | {\sectionfont\bfseries Input Format}
80 | \begin{itemize}[itemsep=0pt]
81 | \item บรรทัดที่ 1: มีจำนวนเต็มสองตัว $R, C$ คั่นด้วยช่องว่าง
82 | \item อีก $R$ บรรทัดถัดมา บรรทัดที่ $i+1$ จะมีสตริงความยาว $C$
83 | ที่ประกอบไปด้วย `\verb|.|' หรือ `\verb|#|' (ซึ่งบอกข้อมูลแถวนั้น ๆ ของแผนที่)
84 | \begin{lstlisting}
85 | R C
86 | M[1,1...C]
87 | M[2,1...C] <%\SuppressNumber\AlternateNumber{...}%>
88 | <%\AlternateNumber{R+1}%>
89 | M[R,1...C] <%\ReactivateNumber%>
90 | \end{lstlisting}
91 | \textbf{หมายเหตุ:} ตัวแปร \verb|M| ข้างต้น คือแผนที่ซึ่งเขียนในรูปของ 1-indexed array สองมิติ
92 | \end{itemize}
93 |
94 | \medskip\noindent
95 | {\sectionfont\bfseries Output Format}
96 | \begin{itemize}
97 | \item คำตอบประกอบด้วยจำนวนเต็มตัวเดียว ซึ่งระบุจำนวนเกาะในแผนที่ที่กำหนดให้
98 | \end{itemize}
99 |
100 | \newpage
101 | \subsection*{\sectionfont\upshape Data Examples}
102 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
103 | \toprule
104 | Example Input & Example Output \\
105 | \midrule
106 | \begin{centervrb}{18}
107 | \begin{plainvrb}
108 | 6 18
109 | ................##
110 | ..#####...##......
111 | .##...##..##...###
112 | .#..#..#.......#..
113 | .#....##..#.#..#.#
114 | .######....#...#.#
115 |
116 | \end{plainvrb}
117 | \end{centervrb} &
118 | \verb|8| \\
119 | \midrule
120 | \begin{centervrb}{7}
121 | \setstretch{0.8}
122 | \begin{plainvrb}
123 | 7 7
124 | .......
125 | ..####.
126 | .#...#.
127 | .#.#.#.
128 | .#...#.
129 | .#####.
130 | .......
131 |
132 | \end{plainvrb}
133 | \end{centervrb} &
134 | \verb|2| \\
135 | \bottomrule
136 | \end{tabular}
137 |
138 | \subsection*{\sectionfont\upshape Constraints}
139 |
140 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
141 | \begin{itemize}
142 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า ${1} \leq R, C \leq {200}$
143 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า ${1} \leq R, C \leq {3000}$
144 | \end{itemize}
145 |
--------------------------------------------------------------------------------
/questions03_coding/south_regional_shippingdolls.tex:
--------------------------------------------------------------------------------
1 | \question{\bfseries Shipping Dools}
2 |
3 | \subsection*{\sectionfont\upshape Problem Statement}
4 |
5 | โรงงานแห่งหนึ่งรับจ้างผลิตตุ๊กตาแบบสั่งทำพิเศษ\;
6 | อยู่มาวันหนึ่งมีลูกค้า A มาติดต่อจ้างให้ผลิตตุ๊กตาทั้งสิ้น $N$ ตัว\;
7 | ตุ๊กตาแต่ละตัวมีหมายเลขกำกับ $i = {1, 2}, \ldots, N$\;
8 | นอกจากนั้น ตุ๊กตาตัวที่ $i$ จะมีน้ำหนัก $w_i$ กรัม ซึ่งอาจเท่ากันหรือต่างกันก็ได้
9 |
10 | เมื่อโรงงานแห่งนี้ผลิตตุ๊กตาเสร็จเป็นที่เรียบร้อยแล้ว โรงงานจะต้องขนส่งตุ๊กตาทั้งหมดนี้ให้ลูกค้า A\;\;
11 | โรงงานสามารถเลือกขนส่งตุ๊กตา\uline{แต่ละตัว}ได้ 2 วิธี คือ
12 | (1) บรรจุตุ๊กตาลงในกล่องพัสดุที่จำกัดน้ำหนัก หรือ
13 | (2) บรรจุตุ๊กตาลงถุงกระสอบที่จำกัดจำนวนตุ๊กตา โดยมีเงื่อนไขว่า
14 | \begin{itemize}
15 | \item การขนส่งอาจใช้กล่องหลายใบก็ได้ กล่องแต่ละใบจุของน้ำหนักรวมไม่เกิน $L$ กรัม
16 | \item การขนส่งสามารถใช้ถุงกระสอบได้เพียงถุงเดียว และใส่ตุ๊กตาได้ไม่เกิน $M$ ตัว (ไม่จำกัดน้ำหนัก)
17 | \item หากตุ๊กตาหมายเลขที่ $s$ และตุ๊กตาหมายเลขที่ $t$ จะถูกบรรจุลงในกล่องใบเดียวกันแล้ว
18 | ตุ๊กตาหมายเลขที่ $i$ แต่ละตัวซึ่งมีหมายเลขอยู่ระหว่าง $s$ กับ $t$
19 | จะต้องถูกบรรจุ\uline{ในกล่องใบ} \uline{เดียวกันด้วย} หรือจะต้องถูกบรรจุ\uline{ในถุงกระสอบ}เท่านั้น
20 | \end{itemize}
21 |
22 | \subsection*{\sectionfont\upshape Main Goal}
23 |
24 | โรงงานต้องการขนส่งตุ๊กตาทั้งหมดให้ลูกค้า $A$ โดยใช้จำนวนกล่องให้น้อยที่สุด จะต้องใช้กล่องทั้งหมดกี่ใบ?
25 |
26 | \subsection*{\sectionfont\upshape Program Specification}
27 |
28 | โปรแกรมที่คุณเขียนจะต้องอ่านข้อมูลจาก stardard input
29 | และเขียนคำตอบลง standard output โดยข้อมูลจะมีฟอร์แมตดังต่อไปนี้
30 |
31 | \bigskip\noindent
32 | {\sectionfont\bfseries Input Format}
33 | \begin{itemize}
34 | \item บรรทัดที่ 1: มีจำนวนเต็มสามตัว $N, L, M$ คั่นด้วยช่องว่าง
35 | \item อีก $N$ บรรทัดถัดมา บรรทัดที่ $i+1$ จะมีจำนวนเต็ม $w_i$ ระบุน้ำหนักของตุ๊กตาตัวที่ $i$
36 | \begin{lstlisting}
37 | N L M
38 | w_1
39 | w_2 <%\SuppressNumber\AlternateNumber{...}%>
40 | <%\AlternateNumber{N+1}%>
41 | w_N <%\ReactivateNumber%>
42 | \end{lstlisting}
43 | \end{itemize}
44 |
45 | \medskip\noindent
46 | {\sectionfont\bfseries Output Format}
47 | \begin{itemize}
48 | \item คำตอบประกอบด้วยจำนวนเต็มตัวเดียว ซึ่งระบุจำนวนกล่องที่น้อยที่สุด%
49 | ที่สามารถใช้ขนส่งตุ๊กตาทั้งหมดตามเงื่อนไขโจทย์ข้างต้น
50 | \end{itemize}
51 |
52 | \newpage
53 | \subsection*{\sectionfont\upshape Data Example}
54 | \begin{tabular}{p{0.45\linewidth}p{0.45\linewidth}}
55 | \toprule
56 | Example Input & Example Output \\
57 | \midrule
58 | \ttfamily\setstretch{0.8}
59 | 6 5 1 \newline
60 | 1 \newline
61 | 2 \newline
62 | 3 \newline
63 | 2 \newline
64 | 1 \newline
65 | 4 &
66 | \ttfamily\setstretch{0.8} 2 \\
67 | \bottomrule
68 | \end{tabular}
69 |
70 | \medskip\noindent
71 | \textbf{อธิบายตัวอย่าง:} หยิบตุ๊กตาตัวที่ $i={3}$ ซึ่ง $w_i = {3}$ ใส่ถุง
72 | จากนั้นหยิบตุ๊กตาตัวที่ ${1, 2, 4}$ ใส่กล่องใบแรก และตัวที่ ${5, 6}$ ใส่กล่องใบที่สอง
73 |
74 | \subsection*{\sectionfont\upshape Constraints}
75 |
76 | โปรแกรมของคุณจะถูกทดสอบกับ test cases สองชุด (เรียกว่าชุดเล็ก และชุดใหญ่)
77 | \begin{itemize}
78 | \item test cases ชุดเล็กจะมีเงื่อนไขว่า ${1} \leq N \leq {250}$
79 | \item test cases ชุดใหญ่จะมีเงื่อนไขว่า ${1} \leq N \leq {2500}$
80 | \item นอกจากนั้นกำหนดให้ ${1} \leq L \leq {10^8};\; {0} \leq M \leq N$
81 | และตุ๊กตาแต่ละตัวมีนำหนัก ${1} \leq w_i \leq L$
82 | \end{itemize}
83 |
--------------------------------------------------------------------------------