├── .gitignore ├── Assignment ├── 04-DMST.pdf ├── Assignment1 │ ├── CS216 Assignment1.md │ └── CS216 Assignment1.pdf ├── Assignment2 │ ├── 04-DMST.pdf │ ├── 05-leftist-heaps-markup.pdf │ ├── figure │ │ ├── figure1.png │ │ ├── figure2.png │ │ └── figure3.png │ ├── report.aux │ ├── report.log │ ├── report.out │ ├── report.pdf │ ├── report.synctex.gz │ ├── report.tex │ ├── report.toc │ └── 勘误.txt ├── Assignment3 │ ├── figure │ │ └── 1.png │ ├── report.aux │ ├── report.log │ ├── report.out │ ├── report.pdf │ ├── report.synctex.gz │ ├── report.tex │ └── report.toc ├── Assignment4 │ ├── figure │ │ ├── 1.png │ │ └── 2.png │ ├── report.aux │ ├── report.log │ ├── report.out │ ├── report.pdf │ ├── report.synctex.gz │ ├── report.tex │ └── report.toc ├── Assignment5 │ ├── figure │ │ ├── 1.png │ │ └── 2.png │ ├── report.aux │ ├── report.log │ ├── report.out │ ├── report.pdf │ ├── report.synctex.gz │ ├── report.tex │ └── report.toc ├── Assignments.txt └── temp_report.tex ├── Lab ├── Lab1 │ ├── Lab1-A.pdf │ ├── Lab1-B.pdf │ ├── a.cpp │ └── b.cpp ├── Lab10 │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ ├── Lab10-A.pdf │ ├── Lab10-B.pdf │ ├── Lab10-C.pdf │ └── Lab10-D.pdf ├── Lab2 │ ├── Lab2-A.pdf │ ├── Lab2-B.pdf │ ├── a.cpp │ └── b.cpp ├── Lab3 │ ├── A.cpp │ ├── B.cpp │ ├── Lab3-A.png │ └── Lab3-B.png ├── Lab4 │ ├── A.cpp │ ├── B.cpp │ ├── Lab4-A.pdf │ └── Lab4-B.pdf ├── Lab5 │ ├── A.cpp │ ├── Lab5-A.pdf │ └── Lab5-B.pdf ├── Lab6 │ ├── A.cpp │ ├── B.cpp │ ├── Lab6-A.pdf │ └── Lab6-B.pdf ├── Lab7 │ ├── A.cpp │ ├── B.cpp │ ├── Lab7-A.pdf │ └── Lab7-B.pdf ├── Lab8 │ ├── A.cpp │ ├── B.cpp │ ├── Lab8-A.pdf │ └── Lab8-B.pdf ├── Lab9 │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ ├── Lab9-A.pdf │ ├── Lab9-B.pdf │ ├── Lab9-C.pdf │ └── Lab9-D.pdf └── temp.cpp ├── README.md ├── assignmentscore.png └── labscore.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | Textbook(Chinese).pdf 3 | Textbook(English).pdf 4 | Lecture* -------------------------------------------------------------------------------- /Assignment/04-DMST.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/04-DMST.pdf -------------------------------------------------------------------------------- /Assignment/Assignment1/CS216 Assignment1.md: -------------------------------------------------------------------------------- 1 | ## CS216 Assignment1 2 | 3 | ###### 12111012 匡亮 4 | 5 | #### 1. Problem 6 | 7 | [Link to sustech space](https://spaces.sustech.cloud/classes/1/assignment/lab1-b) 8 | 9 | #### 2. Algorithm Description 10 | 11 | Initially all $s\in S$ and $c\in C$ are free 12 | 13 | While there is a student $s$ who is free and hasn't applied for all colleges 14 | 15 |         Choose such a student $s$ 16 | 17 |         Let $c$ be the highest-ranked college in $s$'s list which he hasn't applied for 18 | 19 |         If $s_{s,c}>0\land c_{c,s}>0$ then 20 | 21 |                 If $c$ is not full then 22 | 23 |                         Add $s$ to $c$'s student list $student_c$ 24 | 25 |                 Else if $c_{c,s}>\min_{s'\in student_c}\{c_{c,s'}\}$ then 26 | 27 |                         Remove $s'$ from $student_c$ 28 | 29 |                         $s'$ becomes free 30 | 31 |                         Add $s$ to $student_c$ 32 | 33 |                 Else then 34 | 35 |                         $s$ remains free 36 | 37 |                 Endif 38 | 39 |         Endif 40 | 41 | Endwhile 42 | 43 | Return the set of list $student$ 44 | 45 | #### 3. Time Complexity Analysis 46 | 47 | Assume there are $n$ students and $m$ colleges. 48 | 49 | In the worst case, all the students will try to apply for all colleges, and each try cost $O(\log n)$ time as we need to use a priority queue to maintain the worst student of each college. Therefore, the total time complexity is $O(mn\log n)$. 50 | 51 | #### 4. Stability Definition 52 | 53 | The definition below referred to [Lecture01](https://sakai.sustech.edu.cn/access/content/group/7b887991-0c42-450f-8506-9a379cd75e6b/Lecture01-introduction-stable-matching.pdf) P30. 54 | 55 | A matching $S$ in this problem is **unstable** if there exists college $c$ and student $s$ such 56 | that all the following holds: 57 | 58 | + $c_{c,s}>0$ and $s_{s,c}>0$; 59 | 60 | + Either $c$ is not full, or $c$ prefers $s$ to at least one of its enrolled students; 61 | 62 | + Either $s$ is unmatched, or $s$ prefers $c$ to the college he has applied for. 63 | 64 | Also a matching $S$ in this problem is **unstable** if for some $(s,c)\in S$ that $c_{c,s}<0$ or $s_{s,c}<0$. 65 | 66 | #### 5. Correctness Proof 67 | 68 | Obviously we will never match a pair $(s,c)$ that $c_{c,s}<0$ or $s_{s,c}<0$. 69 | 70 | If there exists college $c$ and student $s$ makes $S$ unstable, then there are two possibilities. 71 | 72 | First, $s$ has never applied for $c$. In this case, $s$ is not free at the end, and has been accepted by some other college $c'$, which means $s_{s,c'}>s_{s,c}$ as $s$ applied for $c'$ earlier than $c$. 73 | 74 | Second, $s$ used to be accepted by $c$ but was refused later. In this case, as the student was once kicked out of the list, all the students in the list, including the students joined later, have a higher rank than him. 75 | 76 | The two possibilities above are both contradict with $(s,c)$ makes $S$ unstable. Therefore, $S$ is stable. 77 | 78 | #### 6. Optimality Anlysis 79 | 80 | The anlysis below referred to [Lecture01](https://sakai.sustech.edu.cn/access/content/group/7b887991-0c42-450f-8506-9a379cd75e6b/Lecture01-introduction-stable-matching.pdf) P26-28. 81 | 82 | **Claim.** The matching algorithm in this problem is **student-optimal**. 83 | 84 | **Proof.** Let's prove by contradiction. Suppose $y$ is **the first** student refused by a valid college, and $a$ is **the first** college to do so. 85 | 86 | When $a$ rejected $y$, $a$ has accepted a set of students $student_a$. Since they are never rejected by any valid college, they prefer $a$ to any other valid college. 87 | 88 | Let $S$ be a stable matching in which $a$ accepted $y$, call its student list now $student_{a}'$, then for any $z\in{student_a-student_a'}$, $z$ prefers $y$ to his college $b$, and $y$ prefers $z$ to $a$, therefore $S$ is not stable. 89 | 90 | Therefore, student will never be rejected by a valid college. As students apply for colleges in order of preference, students will always be accepted by their favorite valid college. So the matching algorithm gives us a **student-optimal** matching. 91 | -------------------------------------------------------------------------------- /Assignment/Assignment1/CS216 Assignment1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment1/CS216 Assignment1.pdf -------------------------------------------------------------------------------- /Assignment/Assignment2/04-DMST.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/04-DMST.pdf -------------------------------------------------------------------------------- /Assignment/Assignment2/05-leftist-heaps-markup.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/05-leftist-heaps-markup.pdf -------------------------------------------------------------------------------- /Assignment/Assignment2/figure/figure1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/figure/figure1.png -------------------------------------------------------------------------------- /Assignment/Assignment2/figure/figure2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/figure/figure2.png -------------------------------------------------------------------------------- /Assignment/Assignment2/figure/figure3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/figure/figure3.png -------------------------------------------------------------------------------- /Assignment/Assignment2/report.aux: -------------------------------------------------------------------------------- 1 | \relax 2 | \providecommand\hyper@newdestlabel[2]{} 3 | \providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} 4 | \HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined 5 | \global\let\oldcontentsline\contentsline 6 | \gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} 7 | \global\let\oldnewlabel\newlabel 8 | \gdef\newlabel#1#2{\newlabelxx{#1}#2} 9 | \gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} 10 | \AtEndDocument{\ifx\hyper@anchor\@undefined 11 | \let\contentsline\oldcontentsline 12 | \let\newlabel\oldnewlabel 13 | \fi} 14 | \fi} 15 | \global\let\hyper@last\relax 16 | \gdef\HyperFirstAtBeginDocument#1{#1} 17 | \providecommand*\HyPL@Entry[1]{} 18 | \HyPL@Entry{0<>} 19 | \@writefile{toc}{\contentsline {section}{\numberline {1}Problem Definition}{3}{section.1}\protected@file@percent } 20 | \@writefile{toc}{\contentsline {section}{\numberline {2}Algorithm}{3}{section.2}\protected@file@percent } 21 | \@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Important lemma}{3}{subsection.2.1}\protected@file@percent } 22 | \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces graphic explanation for the proof above}}{4}{figure.1}\protected@file@percent } 23 | \newlabel{1}{{1}{4}{graphic explanation for the proof above}{figure.1}{}} 24 | \@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Algorithm - Contract part}{4}{subsection.2.2}\protected@file@percent } 25 | \@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Algorithm - Expand part}{6}{subsection.2.3}\protected@file@percent } 26 | \@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.1}Expand a vertex}{6}{subsubsection.2.3.1}\protected@file@percent } 27 | \@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.2}Expand a ring}{6}{subsubsection.2.3.2}\protected@file@percent } 28 | \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces graphic explanation for the two functions above}}{7}{figure.2}\protected@file@percent } 29 | \newlabel{2}{{2}{7}{graphic explanation for the two functions above}{figure.2}{}} 30 | \@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Time Complexity Analysis}{7}{subsection.2.4}\protected@file@percent } 31 | \@writefile{toc}{\contentsline {section}{\numberline {3}Data Structures}{8}{section.3}\protected@file@percent } 32 | \@writefile{toc}{\contentsline {subsection}{\numberline {3.1}Lefist Heaps}{8}{subsection.3.1}\protected@file@percent } 33 | \@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces a page of Brian Curless's lecture, see References}}{9}{figure.3}\protected@file@percent } 34 | \newlabel{3}{{3}{9}{a page of Brian Curless's lecture, see References}{figure.3}{}} 35 | \@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Disjoint Set Unions}{9}{subsection.3.2}\protected@file@percent } 36 | \@writefile{toc}{\contentsline {section}{\numberline {4}C++ Code}{10}{section.4}\protected@file@percent } 37 | \@writefile{toc}{\contentsline {section}{\numberline {5}Extensions}{13}{section.5}\protected@file@percent } 38 | \bibcite{MDST}{Uri Zwick(2013)} 39 | \bibcite{LH}{Brian Curless(2008)} 40 | \gdef \@abspage@last{14} 41 | -------------------------------------------------------------------------------- /Assignment/Assignment2/report.log: -------------------------------------------------------------------------------- 1 | This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex 2022.9.29) 25 MAR 2023 22:21 2 | entering extended mode 3 | restricted \write18 enabled. 4 | file:line:error style messages enabled. 5 | %&-line parsing enabled. 6 | **report 7 | (./report.tex 8 | LaTeX2e <2021-11-15> patch level 1 9 | L3 programming layer <2022-02-24> (c:/texlive/2022/texmf-dist/tex/latex/base/article.cls 10 | Document Class: article 2021/10/04 v1.4n Standard LaTeX document class 11 | (c:/texlive/2022/texmf-dist/tex/latex/base/size10.clo 12 | File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option) 13 | ) 14 | \c@part=\count181 15 | \c@section=\count182 16 | \c@subsection=\count183 17 | \c@subsubsection=\count184 18 | \c@paragraph=\count185 19 | \c@subparagraph=\count186 20 | \c@figure=\count187 21 | \c@table=\count188 22 | \abovecaptionskip=\skip47 23 | \belowcaptionskip=\skip48 24 | \bibindent=\dimen138 25 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctex.sty (c:/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.sty 26 | Package: expl3 2022-02-24 L3 programming layer (loader) 27 | (c:/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-xetex.def 28 | File: l3backend-xetex.def 2022-02-07 L3 backend support: XeTeX 29 | (|extractbb --version) 30 | \c__kernel_sys_dvipdfmx_version_int=\count189 31 | \l__color_backend_stack_int=\count190 32 | \g__color_backend_stack_int=\count191 33 | \g__graphics_track_int=\count192 34 | \l__pdf_internal_box=\box50 35 | \g__pdf_backend_object_int=\count193 36 | \g__pdf_backend_annotation_int=\count194 37 | \g__pdf_backend_link_int=\count195 38 | )) 39 | Package: ctex 2021/12/12 v2.5.8 Chinese adapter in LaTeX (CTEX) 40 | (c:/texlive/2022/texmf-dist/tex/latex/l3packages/xparse/xparse.sty 41 | Package: xparse 2022-01-12 L3 Experimental document command parser 42 | ) (c:/texlive/2022/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty 43 | Package: l3keys2e 2022-01-12 LaTeX2e option processing using LaTeX3 keys 44 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctexhook.sty 45 | Package: ctexhook 2021/12/12 v2.5.8 Document and package hooks (CTEX) 46 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctexpatch.sty 47 | Package: ctexpatch 2021/12/12 v2.5.8 Patching commands (CTEX) 48 | ) (c:/texlive/2022/texmf-dist/tex/latex/base/fix-cm.sty 49 | Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX 50 | (c:/texlive/2022/texmf-dist/tex/latex/base/ts1enc.def 51 | File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file 52 | LaTeX Font Info: Redeclaring font encoding TS1 on input line 47. 53 | )) 54 | \l__ctex_tmp_int=\count196 55 | \l__ctex_tmp_box=\box51 56 | \l__ctex_tmp_dim=\dimen139 57 | \g__ctex_section_depth_int=\count197 58 | \g__ctex_font_size_int=\count198 59 | (c:/texlive/2022/texmf-dist/tex/latex/ctex/config/ctexopts.cfg 60 | File: ctexopts.cfg 2021/12/12 v2.5.8 Option configuration file (CTEX) 61 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def 62 | File: ctex-engine-xetex.def 2021/12/12 v2.5.8 XeLaTeX adapter (CTEX) 63 | (c:/texlive/2022/texmf-dist/tex/xelatex/xecjk/xeCJK.sty 64 | Package: xeCJK 2021/12/12 v3.8.8 Typesetting CJK scripts with XeLaTeX 65 | (c:/texlive/2022/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty 66 | Package: xtemplate 2022-01-12 L3 Experimental prototype document functions 67 | \l__xtemplate_tmp_dim=\dimen140 68 | \l__xtemplate_tmp_int=\count199 69 | \l__xtemplate_tmp_muskip=\muskip16 70 | \l__xtemplate_tmp_skip=\skip49 71 | ) 72 | \l__xeCJK_tmp_int=\count266 73 | \l__xeCJK_tmp_box=\box52 74 | \l__xeCJK_tmp_dim=\dimen141 75 | \l__xeCJK_tmp_skip=\skip50 76 | \g__xeCJK_space_factor_int=\count267 77 | \l__xeCJK_begin_int=\count268 78 | \l__xeCJK_end_int=\count269 79 | \c__xeCJK_CJK_class_int=\XeTeXcharclass1 80 | \c__xeCJK_FullLeft_class_int=\XeTeXcharclass2 81 | \c__xeCJK_FullRight_class_int=\XeTeXcharclass3 82 | \c__xeCJK_HalfLeft_class_int=\XeTeXcharclass4 83 | \c__xeCJK_HalfRight_class_int=\XeTeXcharclass5 84 | \c__xeCJK_NormalSpace_class_int=\XeTeXcharclass6 85 | \c__xeCJK_CM_class_int=\XeTeXcharclass7 86 | \c__xeCJK_HangulJamo_class_int=\XeTeXcharclass8 87 | \l__xeCJK_last_skip=\skip51 88 | \g__xeCJK_node_int=\count270 89 | \c__xeCJK_CJK_node_dim=\dimen142 90 | \c__xeCJK_CJK-space_node_dim=\dimen143 91 | \c__xeCJK_default_node_dim=\dimen144 92 | \c__xeCJK_default-space_node_dim=\dimen145 93 | \c__xeCJK_CJK-widow_node_dim=\dimen146 94 | \c__xeCJK_normalspace_node_dim=\dimen147 95 | \l__xeCJK_ccglue_skip=\skip52 96 | \l__xeCJK_ecglue_skip=\skip53 97 | \l__xeCJK_punct_kern_skip=\skip54 98 | \l__xeCJK_last_penalty_int=\count271 99 | \l__xeCJK_last_bound_dim=\dimen148 100 | \l__xeCJK_last_kern_dim=\dimen149 101 | \l__xeCJK_widow_penalty_int=\count272 102 | 103 | Package xtemplate Info: Declaring object type 'xeCJK/punctuation' taking 0 104 | (xtemplate) argument(s) on line 2337. 105 | 106 | \l__xeCJK_fixed_punct_width_dim=\dimen150 107 | \l__xeCJK_mixed_punct_width_dim=\dimen151 108 | \l__xeCJK_middle_punct_width_dim=\dimen152 109 | \l__xeCJK_fixed_margin_width_dim=\dimen153 110 | \l__xeCJK_mixed_margin_width_dim=\dimen154 111 | \l__xeCJK_middle_margin_width_dim=\dimen155 112 | \l__xeCJK_bound_punct_width_dim=\dimen156 113 | \l__xeCJK_bound_margin_width_dim=\dimen157 114 | \l__xeCJK_margin_minimum_dim=\dimen158 115 | \l__xeCJK_kerning_total_width_dim=\dimen159 116 | \l__xeCJK_same_align_margin_dim=\dimen160 117 | \l__xeCJK_different_align_margin_dim=\dimen161 118 | \l__xeCJK_kerning_margin_width_dim=\dimen162 119 | \l__xeCJK_kerning_margin_minimum_dim=\dimen163 120 | \l__xeCJK_bound_dim=\dimen164 121 | \l__xeCJK_reverse_bound_dim=\dimen165 122 | \l__xeCJK_margin_dim=\dimen166 123 | \l__xeCJK_minimum_bound_dim=\dimen167 124 | \l__xeCJK_kerning_margin_dim=\dimen168 125 | \g__xeCJK_family_int=\count273 126 | \l__xeCJK_fam_int=\count274 127 | \g__xeCJK_fam_allocation_int=\count275 128 | \l__xeCJK_verb_case_int=\count276 129 | \l__xeCJK_verb_exspace_skip=\skip55 130 | (c:/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.sty 131 | Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX 132 | (c:/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty 133 | Package: fontspec-xetex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX 134 | \l__fontspec_script_int=\count277 135 | \l__fontspec_language_int=\count278 136 | \l__fontspec_strnum_int=\count279 137 | \l__fontspec_tmp_int=\count280 138 | \l__fontspec_tmpa_int=\count281 139 | \l__fontspec_tmpb_int=\count282 140 | \l__fontspec_tmpc_int=\count283 141 | \l__fontspec_em_int=\count284 142 | \l__fontspec_emdef_int=\count285 143 | \l__fontspec_strong_int=\count286 144 | \l__fontspec_strongdef_int=\count287 145 | \l__fontspec_tmpa_dim=\dimen169 146 | \l__fontspec_tmpb_dim=\dimen170 147 | \l__fontspec_tmpc_dim=\dimen171 148 | (c:/texlive/2022/texmf-dist/tex/latex/base/fontenc.sty 149 | Package: fontenc 2021/04/29 v2.0v Standard LaTeX package 150 | ) (c:/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (c:/texlive/2022/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg 151 | File: xeCJK.cfg 2021/12/12 v3.8.8 Configuration file for xeCJK package 152 | )) 153 | \ccwd=\dimen172 154 | \l__ctex_ccglue_skip=\skip56 155 | ) 156 | \l__ctex_ziju_dim=\dimen173 157 | (c:/texlive/2022/texmf-dist/tex/latex/zhnumber/zhnumber.sty 158 | Package: zhnumber 2020/05/01 v2.8 Typesetting numbers with Chinese glyphs 159 | \l__zhnum_scale_int=\count288 160 | (c:/texlive/2022/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg 161 | File: zhnumber-utf8.cfg 2020/05/01 v2.8 Chinese numerals with UTF8 encoding 162 | )) (c:/texlive/2022/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def 163 | File: ctex-scheme-chinese.def 2021/12/12 v2.5.8 Chinese scheme for generic (CTEX) 164 | (c:/texlive/2022/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg 165 | File: ctex-name-utf8.cfg 2021/12/12 v2.5.8 Caption with encoding UTF-8 (CTEX) 166 | )) (c:/texlive/2022/texmf-dist/tex/latex/tools/indentfirst.sty 167 | Package: indentfirst 1995/11/23 v1.03 Indent first paragraph (DPC) 168 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctex-c5size.clo 169 | File: ctex-c5size.clo 2021/12/12 v2.5.8 c5size option (CTEX) 170 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def 171 | File: ctex-fontset-windows.def 2021/12/12 v2.5.8 Windows fonts definition (CTEX) 172 | 173 | Package fontspec Info: Could not resolve font "KaiTi/B" (it probably doesn't 174 | (fontspec) exist). 175 | 176 | 177 | Package fontspec Info: Could not resolve font "SimHei/I" (it probably doesn't 178 | (fontspec) exist). 179 | 180 | 181 | Package fontspec Info: Could not resolve font "SimSun/BI" (it probably doesn't 182 | (fontspec) exist). 183 | 184 | 185 | Package fontspec Info: Font family 'SimSun(0)' created for font 'SimSun' with 186 | (fontspec) options 187 | (fontspec) [Script={CJK},BoldFont={SimHei},ItalicFont={KaiTi}]. 188 | (fontspec) 189 | (fontspec) This font family consists of the following NFSS 190 | (fontspec) series/shapes: 191 | (fontspec) 192 | (fontspec) - 'normal' (m/n) with NFSS spec.: 193 | (fontspec) <->"SimSun/OT:script=hani;language=dflt;" 194 | (fontspec) - 'small caps' (m/sc) with NFSS spec.: 195 | (fontspec) - 'bold' (b/n) with NFSS spec.: 196 | (fontspec) <->"SimHei/OT:script=hani;language=dflt;" 197 | (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: 198 | (fontspec) - 'italic' (m/it) with NFSS spec.: 199 | (fontspec) <->"KaiTi/OT:script=hani;language=dflt;" 200 | (fontspec) - 'italic small caps' (m/scit) with NFSS spec.: 201 | 202 | )) (c:/texlive/2022/texmf-dist/tex/latex/ctex/config/ctex.cfg 203 | File: ctex.cfg 2021/12/12 v2.5.8 Configuration file (CTEX) 204 | ) (c:/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty 205 | Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR) 206 | (c:/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty 207 | Package: keyval 2014/10/28 v1.15 key=value parser (DPC) 208 | \KV@toks@=\toks16 209 | ) (c:/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty 210 | Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR) 211 | (c:/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty 212 | Package: trig 2021/08/11 v1.11 sin cos tan (DPC) 213 | ) (c:/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg 214 | File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration 215 | ) 216 | Package graphics Info: Driver file: xetex.def on input line 107. 217 | (c:/texlive/2022/texmf-dist/tex/latex/graphics-def/xetex.def 218 | File: xetex.def 2021/03/18 v5.0k Graphics/color driver for xetex 219 | )) 220 | \Gin@req@height=\dimen174 221 | \Gin@req@width=\dimen175 222 | ) (c:/texlive/2022/texmf-dist/tex/latex/float/float.sty 223 | Package: float 2001/11/08 v1.3d Float enhancements (AL) 224 | \c@float@type=\count289 225 | \float@exts=\toks17 226 | \float@box=\box53 227 | \@float@everytoks=\toks18 228 | \@floatcapt=\box54 229 | ) (c:/texlive/2022/texmf-dist/tex/latex/datetime/datetime.sty 230 | Package: datetime 2015/03/20 v2.60 Date Time Package 231 | (c:/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty 232 | Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW) 233 | \etb@tempcnta=\count290 234 | ) (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fmtcount.sty 235 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 236 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 237 | Package: fmtcount 2020/01/30 v3.07 238 | (c:/texlive/2022/texmf-dist/tex/latex/base/ifthen.sty 239 | Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC) 240 | ) (c:/texlive/2022/texmf-dist/tex/latex/xkeyval/xkeyval.sty 241 | Package: xkeyval 2020/11/20 v2.8 package option processing (HA) 242 | (c:/texlive/2022/texmf-dist/tex/generic/xkeyval/xkeyval.tex (c:/texlive/2022/texmf-dist/tex/generic/xkeyval/xkvutils.tex 243 | \XKV@toks=\toks19 244 | \XKV@tempa@toks=\toks20 245 | ) 246 | \XKV@depth=\count291 247 | File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) 248 | )) (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fcprefix.sty 249 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 250 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 251 | Package: fcprefix 2012/09/28 252 | (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fcnumparser.sty 253 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 254 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 255 | Package: fcnumparser 2017/06/15 256 | \fc@digit@counter=\count292 257 | )) (c:/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty 258 | File: amsgen.sty 1999/11/30 v2.0 generic functions 259 | \@emptytoks=\toks21 260 | \ex@=\dimen176 261 | ) 262 | \c@padzeroesN=\count293 263 | \fc@tmpcatcode=\count294 264 | \@DT@modctr=\count295 265 | \@ordinalctr=\count296 266 | \@orgargctr=\count297 267 | \@strctr=\count298 268 | \@tmpstrctr=\count299 269 | \@DT@loopN=\count300 270 | \@DT@X=\count301 271 | ) (c:/texlive/2022/texmf-dist/tex/latex/datetime/datetime-defaults.sty 272 | Package: datetime-defaults 2013/09/10 273 | ) 274 | \@day=\count302 275 | \@month=\count303 276 | \@year=\count304 277 | \c@HOUR=\count305 278 | \c@HOURXII=\count306 279 | \c@MINUTE=\count307 280 | \c@TOHOUR=\count308 281 | \c@TOMINUTE=\count309 282 | \c@SECOND=\count310 283 | \currenthour=\count311 284 | \currentminute=\count312 285 | \currentsecond=\count313 286 | Package datetime Info: No datetime.cfg file found, using default settings on input line 308. 287 | \@dtctr=\count314 288 | \dayofyear=\count315 289 | \dayofweek=\count316 290 | LaTeX Info: Redefining \today on input line 736. 291 | \dt@a=\toks22 292 | \dt@b=\toks23 293 | ) (c:/texlive/2022/texmf-dist/tex/latex/hyperref/hyperref.sty 294 | Package: hyperref 2022-02-21 v7.00n Hypertext links for LaTeX 295 | (c:/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty 296 | Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO) 297 | ) (c:/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty 298 | Package: iftex 2022/02/03 v1.0f TeX engine tests 299 | ) (c:/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty 300 | Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO) 301 | (c:/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty 302 | Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO) 303 | ) 304 | Package pdftexcmds Info: \pdf@primitive is available. 305 | Package pdftexcmds Info: \pdf@ifprimitive is available. 306 | Package pdftexcmds Info: \pdfdraftmode not found. 307 | ) (c:/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty 308 | Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO) 309 | ) (c:/texlive/2022/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty 310 | Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO) 311 | ) (c:/texlive/2022/texmf-dist/tex/generic/pdfescape/pdfescape.sty 312 | Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO) 313 | ) (c:/texlive/2022/texmf-dist/tex/latex/hycolor/hycolor.sty 314 | Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO) 315 | ) (c:/texlive/2022/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty 316 | Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO) 317 | ) (c:/texlive/2022/texmf-dist/tex/latex/auxhook/auxhook.sty 318 | Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO) 319 | ) (c:/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty 320 | Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO) 321 | ) 322 | \@linkdim=\dimen177 323 | \Hy@linkcounter=\count317 324 | \Hy@pagecounter=\count318 325 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/pd1enc.def 326 | File: pd1enc.def 2022-02-21 v7.00n Hyperref: PDFDocEncoding definition (HO) 327 | ) (c:/texlive/2022/texmf-dist/tex/generic/intcalc/intcalc.sty 328 | Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO) 329 | ) (c:/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty 330 | Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO) 331 | ) 332 | \Hy@SavedSpaceFactor=\count319 333 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/puenc.def 334 | File: puenc.def 2022-02-21 v7.00n Hyperref: PDF Unicode definition (HO) 335 | ) 336 | Package hyperref Info: Option `unicode' set `true' on input line 4018. 337 | Package hyperref Info: Hyper figures OFF on input line 4137. 338 | Package hyperref Info: Link nesting OFF on input line 4142. 339 | Package hyperref Info: Hyper index ON on input line 4145. 340 | Package hyperref Info: Plain pages OFF on input line 4152. 341 | Package hyperref Info: Backreferencing OFF on input line 4157. 342 | Package hyperref Info: Implicit mode ON; LaTeX internals redefined. 343 | Package hyperref Info: Bookmarks ON on input line 4390. 344 | \c@Hy@tempcnt=\count320 345 | (c:/texlive/2022/texmf-dist/tex/latex/url/url.sty 346 | \Urlmuskip=\muskip17 347 | Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. 348 | ) 349 | LaTeX Info: Redefining \url on input line 4749. 350 | \XeTeXLinkMargin=\dimen178 351 | (c:/texlive/2022/texmf-dist/tex/generic/bitset/bitset.sty 352 | Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO) 353 | (c:/texlive/2022/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty 354 | Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO) 355 | )) 356 | \Fld@menulength=\count321 357 | \Field@Width=\dimen179 358 | \Fld@charsize=\dimen180 359 | Package hyperref Info: Hyper figures OFF on input line 6027. 360 | Package hyperref Info: Link nesting OFF on input line 6032. 361 | Package hyperref Info: Hyper index ON on input line 6035. 362 | Package hyperref Info: backreferencing OFF on input line 6042. 363 | Package hyperref Info: Link coloring OFF on input line 6047. 364 | Package hyperref Info: Link coloring with OCG OFF on input line 6052. 365 | Package hyperref Info: PDF/A mode OFF on input line 6057. 366 | LaTeX Info: Redefining \ref on input line 6097. 367 | LaTeX Info: Redefining \pageref on input line 6101. 368 | (c:/texlive/2022/texmf-dist/tex/latex/base/atbegshi-ltx.sty 369 | Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi 370 | package with kernel methods 371 | ) 372 | \Hy@abspage=\count322 373 | \c@Item=\count323 374 | \c@Hfootnote=\count324 375 | ) 376 | Package hyperref Info: Driver (autodetected): hxetex. 377 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/hxetex.def 378 | File: hxetex.def 2022-02-21 v7.00n Hyperref driver for XeTeX 379 | (c:/texlive/2022/texmf-dist/tex/generic/stringenc/stringenc.sty 380 | Package: stringenc 2019/11/29 v1.12 Convert strings between diff. encodings (HO) 381 | ) 382 | \pdfm@box=\box55 383 | \c@Hy@AnnotLevel=\count325 384 | \HyField@AnnotCount=\count326 385 | \Fld@listcount=\count327 386 | \c@bookmark@seq@number=\count328 387 | (c:/texlive/2022/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty 388 | Package: rerunfilecheck 2019/12/05 v1.9 Rerun checks for auxiliary files (HO) 389 | (c:/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty 390 | Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend package 391 | with kernel methods 392 | ) (c:/texlive/2022/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty 393 | Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO) 394 | ) 395 | Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 286. 396 | ) 397 | \Hy@SectionHShift=\skip57 398 | ) (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/amssymb.sty 399 | Package: amssymb 2013/01/14 v3.01 AMS font symbols 400 | (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/amsfonts.sty 401 | Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support 402 | \symAMSa=\mathgroup4 403 | \symAMSb=\mathgroup5 404 | LaTeX Font Info: Redeclaring math symbol \hbar on input line 98. 405 | LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' 406 | (Font) U/euf/m/n --> U/euf/b/n on input line 106. 407 | )) (c:/texlive/2022/texmf-dist/tex/latex/amscls/amsthm.sty 408 | Package: amsthm 2020/05/29 v2.20.6 409 | \thm@style=\toks24 410 | \thm@bodyfont=\toks25 411 | \thm@headfont=\toks26 412 | \thm@notefont=\toks27 413 | \thm@headpunct=\toks28 414 | \thm@preskip=\skip58 415 | \thm@postskip=\skip59 416 | \thm@headsep=\skip60 417 | \dth@everypar=\toks29 418 | ) 419 | \c@theorem=\count329 420 | \c@corollary=\count330 421 | \c@lemma=\count331 422 | \c@definition=\count332 423 | (c:/texlive/2022/texmf-dist/tex/latex/listings/listings.sty 424 | \lst@mode=\count333 425 | \lst@gtempboxa=\box56 426 | \lst@token=\toks30 427 | \lst@length=\count334 428 | \lst@currlwidth=\dimen181 429 | \lst@column=\count335 430 | \lst@pos=\count336 431 | \lst@lostspace=\dimen182 432 | \lst@width=\dimen183 433 | \lst@newlines=\count337 434 | \lst@lineno=\count338 435 | \lst@maxwidth=\dimen184 436 | (c:/texlive/2022/texmf-dist/tex/latex/listings/lstmisc.sty 437 | File: lstmisc.sty 2020/03/24 1.8d (Carsten Heinz) 438 | \c@lstnumber=\count339 439 | \lst@skipnumbers=\count340 440 | \lst@framebox=\box57 441 | ) (c:/texlive/2022/texmf-dist/tex/latex/listings/listings.cfg 442 | File: listings.cfg 2020/03/24 1.8d listings configuration 443 | )) 444 | Package: listings 2020/03/24 1.8d (Carsten Heinz) 445 | (c:/texlive/2022/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty 446 | Package: xeCJK-listings 2021/12/12 v3.8.8 xeCJK patch file for listings 447 | \l__xeCJK_listings_max_char_int=\count341 448 | \l__xeCJK_listings_flag_int=\count342 449 | ) (c:/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty 450 | Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK) 451 | (c:/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg 452 | File: color.cfg 2016/01/02 v1.6 sample color configuration 453 | ) 454 | Package xcolor Info: Driver file: xetex.def on input line 227. 455 | Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352. 456 | Package xcolor Info: Model `RGB' extended on input line 1368. 457 | Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370. 458 | Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371. 459 | Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372. 460 | Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373. 461 | Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374. 462 | Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375. 463 | ) (./report.aux) 464 | \openout1 = `report.aux'. 465 | 466 | LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 25. 467 | LaTeX Font Info: ... okay on input line 25. 468 | LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 25. 469 | LaTeX Font Info: ... okay on input line 25. 470 | LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 25. 471 | LaTeX Font Info: ... okay on input line 25. 472 | LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 25. 473 | LaTeX Font Info: ... okay on input line 25. 474 | LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 25. 475 | LaTeX Font Info: ... okay on input line 25. 476 | LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 25. 477 | LaTeX Font Info: ... okay on input line 25. 478 | LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 25. 479 | LaTeX Font Info: ... okay on input line 25. 480 | LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 25. 481 | LaTeX Font Info: ... okay on input line 25. 482 | LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 25. 483 | LaTeX Font Info: ... okay on input line 25. 484 | LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 25. 485 | LaTeX Font Info: ... okay on input line 25. 486 | 487 | Package fontspec Info: Adjusting the maths setup (use [no-math] to avoid 488 | (fontspec) this). 489 | 490 | \symlegacymaths=\mathgroup6 491 | LaTeX Font Info: Overwriting symbol font `legacymaths' in version `bold' 492 | (Font) OT1/cmr/m/n --> OT1/cmr/bx/n on input line 25. 493 | LaTeX Font Info: Redeclaring math accent \acute on input line 25. 494 | LaTeX Font Info: Redeclaring math accent \grave on input line 25. 495 | LaTeX Font Info: Redeclaring math accent \ddot on input line 25. 496 | LaTeX Font Info: Redeclaring math accent \tilde on input line 25. 497 | LaTeX Font Info: Redeclaring math accent \bar on input line 25. 498 | LaTeX Font Info: Redeclaring math accent \breve on input line 25. 499 | LaTeX Font Info: Redeclaring math accent \check on input line 25. 500 | LaTeX Font Info: Redeclaring math accent \hat on input line 25. 501 | LaTeX Font Info: Redeclaring math accent \dot on input line 25. 502 | LaTeX Font Info: Redeclaring math accent \mathring on input line 25. 503 | LaTeX Font Info: Redeclaring math symbol \colon on input line 25. 504 | LaTeX Font Info: Redeclaring math symbol \Gamma on input line 25. 505 | LaTeX Font Info: Redeclaring math symbol \Delta on input line 25. 506 | LaTeX Font Info: Redeclaring math symbol \Theta on input line 25. 507 | LaTeX Font Info: Redeclaring math symbol \Lambda on input line 25. 508 | LaTeX Font Info: Redeclaring math symbol \Xi on input line 25. 509 | LaTeX Font Info: Redeclaring math symbol \Pi on input line 25. 510 | LaTeX Font Info: Redeclaring math symbol \Sigma on input line 25. 511 | LaTeX Font Info: Redeclaring math symbol \Upsilon on input line 25. 512 | LaTeX Font Info: Redeclaring math symbol \Phi on input line 25. 513 | LaTeX Font Info: Redeclaring math symbol \Psi on input line 25. 514 | LaTeX Font Info: Redeclaring math symbol \Omega on input line 25. 515 | LaTeX Font Info: Redeclaring math symbol \mathdollar on input line 25. 516 | LaTeX Font Info: Redeclaring symbol font `operators' on input line 25. 517 | LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font 518 | (Font) `operators' in the math version `normal' on input line 25. 519 | LaTeX Font Info: Overwriting symbol font `operators' in version `normal' 520 | (Font) OT1/cmr/m/n --> TU/lmr/m/n on input line 25. 521 | LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font 522 | (Font) `operators' in the math version `bold' on input line 25. 523 | LaTeX Font Info: Overwriting symbol font `operators' in version `bold' 524 | (Font) OT1/cmr/bx/n --> TU/lmr/m/n on input line 25. 525 | LaTeX Font Info: Overwriting symbol font `operators' in version `normal' 526 | (Font) TU/lmr/m/n --> TU/lmr/m/n on input line 25. 527 | LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal' 528 | (Font) OT1/cmr/m/it --> TU/lmr/m/it on input line 25. 529 | LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal' 530 | (Font) OT1/cmr/bx/n --> TU/lmr/b/n on input line 25. 531 | LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `normal' 532 | (Font) OT1/cmss/m/n --> TU/lmss/m/n on input line 25. 533 | LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `normal' 534 | (Font) OT1/cmtt/m/n --> TU/lmtt/m/n on input line 25. 535 | LaTeX Font Info: Overwriting symbol font `operators' in version `bold' 536 | (Font) TU/lmr/m/n --> TU/lmr/b/n on input line 25. 537 | LaTeX Font Info: Overwriting math alphabet `\mathit' in version `bold' 538 | (Font) OT1/cmr/bx/it --> TU/lmr/b/it on input line 25. 539 | LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `bold' 540 | (Font) OT1/cmss/bx/n --> TU/lmss/b/n on input line 25. 541 | LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `bold' 542 | (Font) OT1/cmtt/m/n --> TU/lmtt/b/n on input line 25. 543 | (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fc-english.def 544 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 545 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 546 | File: fc-english.def 2016/01/12 547 | ) 548 | Package hyperref Info: Link coloring OFF on input line 25. 549 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/nameref.sty 550 | Package: nameref 2021-04-02 v2.47 Cross-referencing by name of section 551 | (c:/texlive/2022/texmf-dist/tex/latex/refcount/refcount.sty 552 | Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO) 553 | ) (c:/texlive/2022/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty 554 | Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO) 555 | ) 556 | \c@section@level=\count343 557 | ) 558 | LaTeX Info: Redefining \ref on input line 25. 559 | LaTeX Info: Redefining \pageref on input line 25. 560 | LaTeX Info: Redefining \nameref on input line 25. 561 | (./report.out) (./report.out) 562 | \@outlinefile=\write3 563 | \openout3 = `report.out'. 564 | 565 | \c@lstlisting=\count344 566 | LaTeX Font Info: Trying to load font information for U+msa on input line 28. 567 | (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/umsa.fd 568 | File: umsa.fd 2013/01/14 v3.01 AMS symbols A 569 | ) 570 | LaTeX Font Info: Trying to load font information for U+msb on input line 28. 571 | (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/umsb.fd 572 | File: umsb.fd 2013/01/14 v3.01 AMS symbols B 573 | ) [1 574 | 575 | ] (./report.toc) 576 | \tf@toc=\write4 577 | \openout4 = `report.toc'. 578 | 579 | [2] [3] 580 | File: figure/figure1.png Graphic file (type bmp) 581 |
582 | [4] [5] [6] 583 | File: figure/figure2.png Graphic file (type bmp) 584 |
585 | [7] 586 | File: figure/figure3.png Graphic file (type bmp) 587 |
588 | [8] (c:/texlive/2022/texmf-dist/tex/latex/listings/lstlang1.sty 589 | File: lstlang1.sty 2020/03/24 1.8d listings language file 590 | ) (c:/texlive/2022/texmf-dist/tex/latex/listings/lstlang1.sty 591 | File: lstlang1.sty 2020/03/24 1.8d listings language file 592 | ) (c:/texlive/2022/texmf-dist/tex/latex/listings/lstmisc.sty 593 | File: lstmisc.sty 2020/03/24 1.8d (Carsten Heinz) 594 | ) [9] 595 | 596 | Package fontspec Info: Could not resolve font "FangSong/BI" (it probably 597 | (fontspec) doesn't exist). 598 | 599 | 600 | Package fontspec Info: Could not resolve font "FangSong/B" (it probably 601 | (fontspec) doesn't exist). 602 | 603 | 604 | Package fontspec Info: Could not resolve font "FangSong/I" (it probably 605 | (fontspec) doesn't exist). 606 | 607 | 608 | Package fontspec Info: Font family 'FangSong(0)' created for font 'FangSong' 609 | (fontspec) with options [Script={CJK}]. 610 | (fontspec) 611 | (fontspec) This font family consists of the following NFSS 612 | (fontspec) series/shapes: 613 | (fontspec) 614 | (fontspec) - 'normal' (m/n) with NFSS spec.: 615 | (fontspec) <->"FangSong/OT:script=hani;language=dflt;" 616 | (fontspec) - 'small caps' (m/sc) with NFSS spec.: 617 | 618 | [10] [11] [12] [13] 619 | Overfull \hbox (14.74457pt too wide) in paragraph at lines 384--385 620 | []\TU/lmr/m/n/10.53937 https://www.cs.princeton.edu/courses/archive/spring13/cos528/directed- 621 | [] 622 | 623 | 624 | Overfull \hbox (31.6181pt too wide) in paragraph at lines 388--389 625 | []\TU/lmr/m/n/10.53937 https://courses.cs.washington.edu/courses/cse326/08sp/lectures/markup/05- 626 | [] 627 | 628 | [14] (./report.aux) 629 | Package rerunfilecheck Info: File `report.out' has not changed. 630 | (rerunfilecheck) Checksum: D35B2D8E30805B0C90E98D96E209F25C;1782. 631 | ) 632 | Here is how much of TeX's memory you used: 633 | 17453 strings out of 476179 634 | 352415 string characters out of 5813072 635 | 1238633 words of memory out of 5000000 636 | 37894 multiletter control sequences out of 15000+600000 637 | 480562 words of font info for 101 fonts, out of 8000000 for 9000 638 | 1348 hyphenation exceptions out of 8191 639 | 89i,6n,97p,1005b,1272s stack positions out of 10000i,1000n,20000p,200000b,200000s 640 | 641 | Output written on report.pdf (14 pages). 642 | -------------------------------------------------------------------------------- /Assignment/Assignment2/report.out: -------------------------------------------------------------------------------- 1 | \BOOKMARK [1][-]{section.1}{\376\377\000P\000r\000o\000b\000l\000e\000m\000\040\000D\000e\000f\000i\000n\000i\000t\000i\000o\000n}{}% 1 2 | \BOOKMARK [1][-]{section.2}{\376\377\000A\000l\000g\000o\000r\000i\000t\000h\000m}{}% 2 3 | \BOOKMARK [2][-]{subsection.2.1}{\376\377\000I\000m\000p\000o\000r\000t\000a\000n\000t\000\040\000l\000e\000m\000m\000a}{section.2}% 3 4 | \BOOKMARK [2][-]{subsection.2.2}{\376\377\000A\000l\000g\000o\000r\000i\000t\000h\000m\000\040\000-\000\040\000C\000o\000n\000t\000r\000a\000c\000t\000\040\000p\000a\000r\000t}{section.2}% 4 5 | \BOOKMARK [2][-]{subsection.2.3}{\376\377\000A\000l\000g\000o\000r\000i\000t\000h\000m\000\040\000-\000\040\000E\000x\000p\000a\000n\000d\000\040\000p\000a\000r\000t}{section.2}% 5 6 | \BOOKMARK [3][-]{subsubsection.2.3.1}{\376\377\000E\000x\000p\000a\000n\000d\000\040\000a\000\040\000v\000e\000r\000t\000e\000x}{subsection.2.3}% 6 7 | \BOOKMARK [3][-]{subsubsection.2.3.2}{\376\377\000E\000x\000p\000a\000n\000d\000\040\000a\000\040\000r\000i\000n\000g}{subsection.2.3}% 7 8 | \BOOKMARK [2][-]{subsection.2.4}{\376\377\000T\000i\000m\000e\000\040\000C\000o\000m\000p\000l\000e\000x\000i\000t\000y\000\040\000A\000n\000a\000l\000y\000s\000i\000s}{section.2}% 8 9 | \BOOKMARK [1][-]{section.3}{\376\377\000D\000a\000t\000a\000\040\000S\000t\000r\000u\000c\000t\000u\000r\000e\000s}{}% 9 10 | \BOOKMARK [2][-]{subsection.3.1}{\376\377\000L\000e\000f\000i\000s\000t\000\040\000H\000e\000a\000p\000s}{section.3}% 10 11 | \BOOKMARK [2][-]{subsection.3.2}{\376\377\000D\000i\000s\000j\000o\000i\000n\000t\000\040\000S\000e\000t\000\040\000U\000n\000i\000o\000n\000s}{section.3}% 11 12 | \BOOKMARK [1][-]{section.4}{\376\377\000C\000+\000+\000\040\000C\000o\000d\000e}{}% 12 13 | \BOOKMARK [1][-]{section.5}{\376\377\000E\000x\000t\000e\000n\000s\000i\000o\000n\000s}{}% 13 14 | -------------------------------------------------------------------------------- /Assignment/Assignment2/report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/report.pdf -------------------------------------------------------------------------------- /Assignment/Assignment2/report.synctex.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment2/report.synctex.gz -------------------------------------------------------------------------------- /Assignment/Assignment2/report.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{ctex} 4 | \usepackage{graphicx} 5 | \usepackage{float} 6 | \usepackage{datetime} 7 | \usepackage{hyperref} 8 | \usepackage{amssymb} 9 | \usepackage{amsthm} 10 | \newtheorem{theorem}{Theorem} 11 | \newtheorem{corollary}{Colollary} 12 | \newtheorem{lemma}{Lemma} 13 | \newtheorem{definition}{Definition} 14 | \renewcommand\proofname{Proof} 15 | \renewcommand\figurename{Figure} 16 | \usepackage{listings} 17 | \usepackage{xcolor} 18 | 19 | \title{CS216 Assignment2 \\ {\begin{large} Solve DMST Problem in $O(m\log n)$ Time\end{large}}} 20 | 21 | \author{匡亮(12111012)} 22 | 23 | \date{March 24, 2023} 24 | 25 | \begin{document} 26 | 27 | \maketitle 28 | 29 | \renewcommand\abstractname{Abstract} 30 | \begin{abstract} 31 | 32 | This is my report of CS216 Assignment2, including: 33 | 34 | \begin{itemize} 35 | \item[1.] What the Directed Minimum Spanning Tree problem is. 36 | \item[2.] How Edmond's Algorithm solves this problem and how Tarjan's implementation improves it to $O(m\log n)$. 37 | \item[3.] A sample code in C++ and detailed time complexity analysis. 38 | \item[4.] A little expansion. 39 | \end{itemize} 40 | 41 | \end{abstract} 42 | 43 | \newpage 44 | 45 | \renewcommand\contentsname{Contents} 46 | \tableofcontents 47 | 48 | \newpage 49 | 50 | \section{Problem Definition} 51 | 52 | Let $G=(V,E,w)$ be a weighted directed graph, where $w:E\to\mathbb{R}$ is the cost function. Let $r\in V$. A directed spanning tree (DST) of G rooted at $r$, is a subgraph $T$ of $G$ such that the undirected version of $T$ is a tree and $T$ contains a directed path from $r$ to any other vertex in $V$. The one with the minimum total cost is called the minimum directed spanning tree (MDST). The problem is to find a MDST on a given graph $G$ and a given root $r$. 53 | 54 | For convenience, in the whole report we assume $|V|=n,|E|=m$ $O(\log m)=O(\log n)$. 55 | 56 | \section{Algorithm} 57 | 58 | \subsection{Important lemma} 59 | 60 | The whole algorithm is based on a subtle lemma. 61 | 62 | \begin{lemma} 63 | For each vertex $v\in V/\{r\}$, let $e_v$ be the entering edge of $v$ with minimum cost, and let $E'$ be the edge set of all $n-1$ different $e_v$, then: 64 | \begin{itemize} 65 | \item [1.] If there is no rings in $E'$, then $E'$ is the MDST. 66 | \item [2.] Otherwise, for each circle $C_i\in E'$, there is a MDST containing $|C_i|-1$ edges in $C_i$. 67 | \end{itemize} 68 | \end{lemma} 69 | 70 | \begin{proof} 71 | The first one is trival. We need an entering edge for each vertex except $r$, and fortunately we independently minimized each of them, then we literally get the MDST. 72 | 73 | For the second one, it is trival for the case $|C|=1$. Otherwise, let the circle $C=v_1\to v_2\to...\to v_k\to v_1$ and W.L.O.G let $v_1$ be one of the closest vertices to $r$ on the circle, i.e. there is not an ancestor of $v_1$ in $C$ (note that the edge $(v_k,v_1)\not\in T$). Assume that $e_{v_{i+1}}=(v_i,v_{i+1})\not\in T, 1\le i 220 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 221 | using namespace std; 222 | const int MAXN = 400000 + 10; 223 | const long long INF = 1ll << 40; 224 | 225 | typedef pair, pair> Edge; // An edge in the graph 226 | #define W first.first 227 | #define W0 first.second 228 | #define U second.first 229 | #define V second.second 230 | #define EDGE(u, v, w) make_pair(make_pair(w, w), make_pair(u, v)) 231 | const Edge EDGENULL = EDGE(0, 0, 0); 232 | 233 | template 234 | struct Node { // Leftist Tree Node 235 | Node *ls, *rs; 236 | int npl; // Null-Path Length 237 | T val; 238 | long long tag; 239 | Node() { ls = rs = NULL; npl = -1; } 240 | Node(T v): Node() { npl = 0; val = v; tag = 0; } 241 | }; 242 | template 243 | inline void gettag(Node *a, long long gtag) { 244 | if(a != NULL) { 245 | a->tag += gtag; 246 | a->val.W += gtag; 247 | } 248 | } 249 | template 250 | inline void pushdown(Node *a) { 251 | if(a->tag) { 252 | gettag(a->ls, a->tag); 253 | gettag(a->rs, a->tag); 254 | a->tag = 0; 255 | } 256 | } 257 | template 258 | Node* merge(Node *a, Node *b) { 259 | if(a == NULL) return b; 260 | if(b == NULL) return a; 261 | if(a->val > b->val) swap(a, b); 262 | pushdown(a); 263 | a->rs = merge(a->rs, b); 264 | if(a->ls == NULL || a->rs->npl > a->ls->npl) swap(a->ls, a->rs); 265 | a->npl = a->rs == NULL ? 0 : a->rs->npl + 1; 266 | return a; 267 | } 268 | 269 | int n, m, r; 270 | 271 | Node* node[MAXN]; // Leftist Tree root of each super-vertex 272 | Edge in[MAXN]; // In-edge of each node during the contracting process 273 | int parent[MAXN]; // Each (super-)vertex in which super-vertex 274 | vector children[MAXN]; // The children of each super-vertex (empty for original vertex) 275 | inline void addEdge(int u, int v, long long w) { 276 | node[v] = merge(node[v], new Node(EDGE(u, v, w))); 277 | } 278 | 279 | // Use a Union Set to maintain which super-vertex each vertex is in 280 | int f[MAXN]; 281 | int F(int n) { 282 | return n == f[n] ? n : f[n] = F(f[n]); 283 | } 284 | 285 | /* 286 | * To make the code more general, instead of calculate the total value, 287 | * we want to actually construct the DMST, which will not change our 288 | * time complexity but cost a little more time. 289 | */ 290 | Edge tree[MAXN]; // The finally in-edge of each node on DMST 291 | void expand_ring(int nod); 292 | 293 | /* 294 | * expand_node: We found an original vertex, who is the in-node of 295 | * several layers of super-vertices, and the highest layer of which 296 | * is root. Now we want to calculate the total value of these layers, 297 | * i.e. the total value inside the super-vertex root. 298 | */ 299 | void expand_node(int nod, int root) { 300 | while(nod != root) { 301 | expand_ring(nod); 302 | nod = parent[nod]; 303 | } 304 | } 305 | 306 | /* 307 | * expand_ring: We found a (super-)vertex, who is the in-node of 308 | * his parent super-vertex. Now we want to calculate the total 309 | * value of this layer. 310 | */ 311 | void expand_ring(int nod) { 312 | for(auto peer : children[parent[nod]]) 313 | if(peer != nod) { 314 | tree[in[peer].V] = in[peer]; // report an edge 315 | expand_node(in[peer].V, peer); 316 | } 317 | } 318 | 319 | int main() { 320 | /* 321 | * input 322 | * The first input n, m, r representing the number of vertices and edges, 323 | * and the id of the root. The m lines below input u, v, w each line 324 | * represent an edge E(u, v) = w in the graph. 325 | */ 326 | cin >> n >> m >> r; 327 | For(i, 1, m) { 328 | int u, v, w; 329 | cin >> u >> v >> w; 330 | addEdge(u, v, w); 331 | } 332 | For(i, 1, n) addEdge(i, i % n + 1, INF); // Make the graph strongly connected 333 | // initialize 334 | For(i, 1, n) f[i] = i; 335 | // contract 336 | int a = 1; // The (super-)vertex we are considering 337 | int cnt = n; 338 | while(node[a] != NULL) { // While LeftistTree[a] is not empty 339 | // get and delete min 340 | Edge edge = node[a]->val; 341 | pushdown(node[a]); 342 | node[a] = merge(node[a]->ls, node[a]->rs); 343 | int b = F(edge.U); // b is the super-vertex which u is in 344 | if(b != a) { 345 | in[a] = edge; 346 | if(in[b] == EDGENULL) a = b; // append the link 347 | else { 348 | int c = ++cnt; // c is the new super-vertex 349 | f[c] = c; 350 | while(a != c) { // When a == c, we have returned the start point 351 | parent[a] = c; 352 | f[a] = c; 353 | children[c].push_back(a); 354 | gettag(node[a], -in[a].W); 355 | node[c] = merge(node[c], node[a]); 356 | a = F(in[a].U); 357 | } 358 | a = c; 359 | } 360 | } 361 | } 362 | // expand 363 | expand_node(r, cnt); 364 | // now, tree[t] for 1 <= t <= n (except tree[r]) contains all edges in DMST 365 | long long ans = 0; 366 | For(i, 1, n) 367 | if(i != r) ans += tree[i].W0; 368 | if(ans >= INF) cout << -1 << endl; 369 | else cout << ans << endl; 370 | return 0; 371 | } 372 | \end{lstlisting} 373 | 374 | \section{Extensions} 375 | 376 | What if we are not given a root $r$ but required to find an optimal $r$ so that the total cost of our MDST is minimized? We can add a virture super source vertex $s$, add edges $(s,1),(s,2),...,(s,n)$ with weight $INF$, and again make the whole graph strongly connected. Then, use the algorithm above to solve the problem with the new graph and root $s$. If the total cost is greater than $2\times INF$, then there is no legal solution. Otherwise, we ignore the only edge beginning from $s$, and the other edges form the optimal MDST. 377 | 378 | \newpage 379 | 380 | \renewcommand\refname{References} 381 | \begin{thebibliography}{99} 382 | \bibitem[Uri Zwick(2013)]{MDST} Directed Minimum Spanning Trees 383 | 384 | https://www.cs.princeton.edu/courses/archive/spring13/cos528/directed-mst-1.pdf 385 | 386 | \bibitem[Brian Curless(2008)]{LH} Lefist Heaps 387 | 388 | https://courses.cs.washington.edu/courses/cse326/08sp/lectures/markup/05-leftist-heaps-markup.pdf 389 | \end{thebibliography} 390 | 391 | \end{document} 392 | -------------------------------------------------------------------------------- /Assignment/Assignment2/report.toc: -------------------------------------------------------------------------------- 1 | \contentsline {section}{\numberline {1}Problem Definition}{3}{section.1}% 2 | \contentsline {section}{\numberline {2}Algorithm}{3}{section.2}% 3 | \contentsline {subsection}{\numberline {2.1}Important lemma}{3}{subsection.2.1}% 4 | \contentsline {subsection}{\numberline {2.2}Algorithm - Contract part}{4}{subsection.2.2}% 5 | \contentsline {subsection}{\numberline {2.3}Algorithm - Expand part}{6}{subsection.2.3}% 6 | \contentsline {subsubsection}{\numberline {2.3.1}Expand a vertex}{6}{subsubsection.2.3.1}% 7 | \contentsline {subsubsection}{\numberline {2.3.2}Expand a ring}{6}{subsubsection.2.3.2}% 8 | \contentsline {subsection}{\numberline {2.4}Time Complexity Analysis}{7}{subsection.2.4}% 9 | \contentsline {section}{\numberline {3}Data Structures}{8}{section.3}% 10 | \contentsline {subsection}{\numberline {3.1}Lefist Heaps}{8}{subsection.3.1}% 11 | \contentsline {subsection}{\numberline {3.2}Disjoint Set Unions}{9}{subsection.3.2}% 12 | \contentsline {section}{\numberline {4}C++ Code}{10}{section.4}% 13 | \contentsline {section}{\numberline {5}Extensions}{13}{section.5}% 14 | -------------------------------------------------------------------------------- /Assignment/Assignment2/勘误.txt: -------------------------------------------------------------------------------- 1 | 今天偶然看这份作业发现了一个错误: 2 | pdf第八页,介绍左偏树的第一段末尾,npl不是距离“后代叶子”的距离,而是距离“后代空节点”的距离 3 | 如果一个节点没有左或右儿子,就把它没有的儿子视为是有null儿子,规定npl[null]=-1,npl[叶子]=0,下面的引理(根npl=n时至少有2^(n+1)-1个节点)才能成立 4 | -------------------------------------------------------------------------------- /Assignment/Assignment3/figure/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment3/figure/1.png -------------------------------------------------------------------------------- /Assignment/Assignment3/report.aux: -------------------------------------------------------------------------------- 1 | \relax 2 | \providecommand\hyper@newdestlabel[2]{} 3 | \providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} 4 | \HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined 5 | \global\let\oldcontentsline\contentsline 6 | \gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} 7 | \global\let\oldnewlabel\newlabel 8 | \gdef\newlabel#1#2{\newlabelxx{#1}#2} 9 | \gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} 10 | \AtEndDocument{\ifx\hyper@anchor\@undefined 11 | \let\contentsline\oldcontentsline 12 | \let\newlabel\oldnewlabel 13 | \fi} 14 | \fi} 15 | \global\let\hyper@last\relax 16 | \gdef\HyperFirstAtBeginDocument#1{#1} 17 | \providecommand*\HyPL@Entry[1]{} 18 | \HyPL@Entry{0<>} 19 | \@writefile{toc}{\contentsline {section}{\numberline {1}Converting signals}{3}{section.1}\protected@file@percent } 20 | \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Lecture07-dnc-multiplication-and-fft.pdf Page20}}{3}{figure.1}\protected@file@percent } 21 | \newlabel{1}{{1}{3}{Lecture07-dnc-multiplication-and-fft.pdf Page20}{figure.1}{}} 22 | \@writefile{toc}{\contentsline {section}{\numberline {2}Arbitrary-precision multiplication}{4}{section.2}\protected@file@percent } 23 | \@writefile{toc}{\contentsline {section}{\numberline {3}More applications}{5}{section.3}\protected@file@percent } 24 | \@writefile{toc}{\contentsline {subsection}{\numberline {3.1}Audio editing}{5}{subsection.3.1}\protected@file@percent } 25 | \@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Image compression}{5}{subsection.3.2}\protected@file@percent } 26 | \@writefile{toc}{\contentsline {subsection}{\numberline {3.3}Computer vision}{5}{subsection.3.3}\protected@file@percent } 27 | \@writefile{toc}{\contentsline {section}{\numberline {4}Conclusion}{5}{section.4}\protected@file@percent } 28 | \bibcite{video1}{Reducible(2021)} 29 | \bibcite{video2}{Steve Brunton(2020)} 30 | \bibcite{video3}{Steve Brunton(2021)} 31 | \bibcite{video4}{丘比特的帽子(2022)} 32 | \bibcite{video5}{DR CAN(2018)} 33 | \gdef \@abspage@last{6} 34 | -------------------------------------------------------------------------------- /Assignment/Assignment3/report.log: -------------------------------------------------------------------------------- 1 | This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex 2022.9.29) 22 APR 2023 21:37 2 | entering extended mode 3 | restricted \write18 enabled. 4 | file:line:error style messages enabled. 5 | %&-line parsing enabled. 6 | **report 7 | (./report.tex 8 | LaTeX2e <2021-11-15> patch level 1 9 | L3 programming layer <2022-02-24> (c:/texlive/2022/texmf-dist/tex/latex/base/article.cls 10 | Document Class: article 2021/10/04 v1.4n Standard LaTeX document class 11 | (c:/texlive/2022/texmf-dist/tex/latex/base/size10.clo 12 | File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option) 13 | ) 14 | \c@part=\count181 15 | \c@section=\count182 16 | \c@subsection=\count183 17 | \c@subsubsection=\count184 18 | \c@paragraph=\count185 19 | \c@subparagraph=\count186 20 | \c@figure=\count187 21 | \c@table=\count188 22 | \abovecaptionskip=\skip47 23 | \belowcaptionskip=\skip48 24 | \bibindent=\dimen138 25 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctex.sty (c:/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.sty 26 | Package: expl3 2022-02-24 L3 programming layer (loader) 27 | (c:/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-xetex.def 28 | File: l3backend-xetex.def 2022-02-07 L3 backend support: XeTeX 29 | (|extractbb --version) 30 | \c__kernel_sys_dvipdfmx_version_int=\count189 31 | \l__color_backend_stack_int=\count190 32 | \g__color_backend_stack_int=\count191 33 | \g__graphics_track_int=\count192 34 | \l__pdf_internal_box=\box50 35 | \g__pdf_backend_object_int=\count193 36 | \g__pdf_backend_annotation_int=\count194 37 | \g__pdf_backend_link_int=\count195 38 | )) 39 | Package: ctex 2021/12/12 v2.5.8 Chinese adapter in LaTeX (CTEX) 40 | (c:/texlive/2022/texmf-dist/tex/latex/l3packages/xparse/xparse.sty 41 | Package: xparse 2022-01-12 L3 Experimental document command parser 42 | ) (c:/texlive/2022/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty 43 | Package: l3keys2e 2022-01-12 LaTeX2e option processing using LaTeX3 keys 44 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctexhook.sty 45 | Package: ctexhook 2021/12/12 v2.5.8 Document and package hooks (CTEX) 46 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctexpatch.sty 47 | Package: ctexpatch 2021/12/12 v2.5.8 Patching commands (CTEX) 48 | ) (c:/texlive/2022/texmf-dist/tex/latex/base/fix-cm.sty 49 | Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX 50 | (c:/texlive/2022/texmf-dist/tex/latex/base/ts1enc.def 51 | File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file 52 | LaTeX Font Info: Redeclaring font encoding TS1 on input line 47. 53 | )) 54 | \l__ctex_tmp_int=\count196 55 | \l__ctex_tmp_box=\box51 56 | \l__ctex_tmp_dim=\dimen139 57 | \g__ctex_section_depth_int=\count197 58 | \g__ctex_font_size_int=\count198 59 | (c:/texlive/2022/texmf-dist/tex/latex/ctex/config/ctexopts.cfg 60 | File: ctexopts.cfg 2021/12/12 v2.5.8 Option configuration file (CTEX) 61 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def 62 | File: ctex-engine-xetex.def 2021/12/12 v2.5.8 XeLaTeX adapter (CTEX) 63 | (c:/texlive/2022/texmf-dist/tex/xelatex/xecjk/xeCJK.sty 64 | Package: xeCJK 2021/12/12 v3.8.8 Typesetting CJK scripts with XeLaTeX 65 | (c:/texlive/2022/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty 66 | Package: xtemplate 2022-01-12 L3 Experimental prototype document functions 67 | \l__xtemplate_tmp_dim=\dimen140 68 | \l__xtemplate_tmp_int=\count199 69 | \l__xtemplate_tmp_muskip=\muskip16 70 | \l__xtemplate_tmp_skip=\skip49 71 | ) 72 | \l__xeCJK_tmp_int=\count266 73 | \l__xeCJK_tmp_box=\box52 74 | \l__xeCJK_tmp_dim=\dimen141 75 | \l__xeCJK_tmp_skip=\skip50 76 | \g__xeCJK_space_factor_int=\count267 77 | \l__xeCJK_begin_int=\count268 78 | \l__xeCJK_end_int=\count269 79 | \c__xeCJK_CJK_class_int=\XeTeXcharclass1 80 | \c__xeCJK_FullLeft_class_int=\XeTeXcharclass2 81 | \c__xeCJK_FullRight_class_int=\XeTeXcharclass3 82 | \c__xeCJK_HalfLeft_class_int=\XeTeXcharclass4 83 | \c__xeCJK_HalfRight_class_int=\XeTeXcharclass5 84 | \c__xeCJK_NormalSpace_class_int=\XeTeXcharclass6 85 | \c__xeCJK_CM_class_int=\XeTeXcharclass7 86 | \c__xeCJK_HangulJamo_class_int=\XeTeXcharclass8 87 | \l__xeCJK_last_skip=\skip51 88 | \g__xeCJK_node_int=\count270 89 | \c__xeCJK_CJK_node_dim=\dimen142 90 | \c__xeCJK_CJK-space_node_dim=\dimen143 91 | \c__xeCJK_default_node_dim=\dimen144 92 | \c__xeCJK_default-space_node_dim=\dimen145 93 | \c__xeCJK_CJK-widow_node_dim=\dimen146 94 | \c__xeCJK_normalspace_node_dim=\dimen147 95 | \l__xeCJK_ccglue_skip=\skip52 96 | \l__xeCJK_ecglue_skip=\skip53 97 | \l__xeCJK_punct_kern_skip=\skip54 98 | \l__xeCJK_last_penalty_int=\count271 99 | \l__xeCJK_last_bound_dim=\dimen148 100 | \l__xeCJK_last_kern_dim=\dimen149 101 | \l__xeCJK_widow_penalty_int=\count272 102 | 103 | Package xtemplate Info: Declaring object type 'xeCJK/punctuation' taking 0 104 | (xtemplate) argument(s) on line 2337. 105 | 106 | \l__xeCJK_fixed_punct_width_dim=\dimen150 107 | \l__xeCJK_mixed_punct_width_dim=\dimen151 108 | \l__xeCJK_middle_punct_width_dim=\dimen152 109 | \l__xeCJK_fixed_margin_width_dim=\dimen153 110 | \l__xeCJK_mixed_margin_width_dim=\dimen154 111 | \l__xeCJK_middle_margin_width_dim=\dimen155 112 | \l__xeCJK_bound_punct_width_dim=\dimen156 113 | \l__xeCJK_bound_margin_width_dim=\dimen157 114 | \l__xeCJK_margin_minimum_dim=\dimen158 115 | \l__xeCJK_kerning_total_width_dim=\dimen159 116 | \l__xeCJK_same_align_margin_dim=\dimen160 117 | \l__xeCJK_different_align_margin_dim=\dimen161 118 | \l__xeCJK_kerning_margin_width_dim=\dimen162 119 | \l__xeCJK_kerning_margin_minimum_dim=\dimen163 120 | \l__xeCJK_bound_dim=\dimen164 121 | \l__xeCJK_reverse_bound_dim=\dimen165 122 | \l__xeCJK_margin_dim=\dimen166 123 | \l__xeCJK_minimum_bound_dim=\dimen167 124 | \l__xeCJK_kerning_margin_dim=\dimen168 125 | \g__xeCJK_family_int=\count273 126 | \l__xeCJK_fam_int=\count274 127 | \g__xeCJK_fam_allocation_int=\count275 128 | \l__xeCJK_verb_case_int=\count276 129 | \l__xeCJK_verb_exspace_skip=\skip55 130 | (c:/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.sty 131 | Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX 132 | (c:/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty 133 | Package: fontspec-xetex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX 134 | \l__fontspec_script_int=\count277 135 | \l__fontspec_language_int=\count278 136 | \l__fontspec_strnum_int=\count279 137 | \l__fontspec_tmp_int=\count280 138 | \l__fontspec_tmpa_int=\count281 139 | \l__fontspec_tmpb_int=\count282 140 | \l__fontspec_tmpc_int=\count283 141 | \l__fontspec_em_int=\count284 142 | \l__fontspec_emdef_int=\count285 143 | \l__fontspec_strong_int=\count286 144 | \l__fontspec_strongdef_int=\count287 145 | \l__fontspec_tmpa_dim=\dimen169 146 | \l__fontspec_tmpb_dim=\dimen170 147 | \l__fontspec_tmpc_dim=\dimen171 148 | (c:/texlive/2022/texmf-dist/tex/latex/base/fontenc.sty 149 | Package: fontenc 2021/04/29 v2.0v Standard LaTeX package 150 | ) (c:/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (c:/texlive/2022/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg 151 | File: xeCJK.cfg 2021/12/12 v3.8.8 Configuration file for xeCJK package 152 | )) 153 | \ccwd=\dimen172 154 | \l__ctex_ccglue_skip=\skip56 155 | ) 156 | \l__ctex_ziju_dim=\dimen173 157 | (c:/texlive/2022/texmf-dist/tex/latex/zhnumber/zhnumber.sty 158 | Package: zhnumber 2020/05/01 v2.8 Typesetting numbers with Chinese glyphs 159 | \l__zhnum_scale_int=\count288 160 | (c:/texlive/2022/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg 161 | File: zhnumber-utf8.cfg 2020/05/01 v2.8 Chinese numerals with UTF8 encoding 162 | )) (c:/texlive/2022/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def 163 | File: ctex-scheme-chinese.def 2021/12/12 v2.5.8 Chinese scheme for generic (CTEX) 164 | (c:/texlive/2022/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg 165 | File: ctex-name-utf8.cfg 2021/12/12 v2.5.8 Caption with encoding UTF-8 (CTEX) 166 | )) (c:/texlive/2022/texmf-dist/tex/latex/tools/indentfirst.sty 167 | Package: indentfirst 1995/11/23 v1.03 Indent first paragraph (DPC) 168 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/ctex-c5size.clo 169 | File: ctex-c5size.clo 2021/12/12 v2.5.8 c5size option (CTEX) 170 | ) (c:/texlive/2022/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def 171 | File: ctex-fontset-windows.def 2021/12/12 v2.5.8 Windows fonts definition (CTEX) 172 | 173 | Package fontspec Info: Could not resolve font "KaiTi/B" (it probably doesn't 174 | (fontspec) exist). 175 | 176 | 177 | Package fontspec Info: Could not resolve font "SimHei/I" (it probably doesn't 178 | (fontspec) exist). 179 | 180 | 181 | Package fontspec Info: Could not resolve font "SimSun/BI" (it probably doesn't 182 | (fontspec) exist). 183 | 184 | 185 | Package fontspec Info: Font family 'SimSun(0)' created for font 'SimSun' with 186 | (fontspec) options 187 | (fontspec) [Script={CJK},BoldFont={SimHei},ItalicFont={KaiTi}]. 188 | (fontspec) 189 | (fontspec) This font family consists of the following NFSS 190 | (fontspec) series/shapes: 191 | (fontspec) 192 | (fontspec) - 'normal' (m/n) with NFSS spec.: 193 | (fontspec) <->"SimSun/OT:script=hani;language=dflt;" 194 | (fontspec) - 'small caps' (m/sc) with NFSS spec.: 195 | (fontspec) - 'bold' (b/n) with NFSS spec.: 196 | (fontspec) <->"SimHei/OT:script=hani;language=dflt;" 197 | (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: 198 | (fontspec) - 'italic' (m/it) with NFSS spec.: 199 | (fontspec) <->"KaiTi/OT:script=hani;language=dflt;" 200 | (fontspec) - 'italic small caps' (m/scit) with NFSS spec.: 201 | 202 | )) (c:/texlive/2022/texmf-dist/tex/latex/ctex/config/ctex.cfg 203 | File: ctex.cfg 2021/12/12 v2.5.8 Configuration file (CTEX) 204 | ) (c:/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty 205 | Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR) 206 | (c:/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty 207 | Package: keyval 2014/10/28 v1.15 key=value parser (DPC) 208 | \KV@toks@=\toks16 209 | ) (c:/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty 210 | Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR) 211 | (c:/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty 212 | Package: trig 2021/08/11 v1.11 sin cos tan (DPC) 213 | ) (c:/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg 214 | File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration 215 | ) 216 | Package graphics Info: Driver file: xetex.def on input line 107. 217 | (c:/texlive/2022/texmf-dist/tex/latex/graphics-def/xetex.def 218 | File: xetex.def 2021/03/18 v5.0k Graphics/color driver for xetex 219 | )) 220 | \Gin@req@height=\dimen174 221 | \Gin@req@width=\dimen175 222 | ) (c:/texlive/2022/texmf-dist/tex/latex/float/float.sty 223 | Package: float 2001/11/08 v1.3d Float enhancements (AL) 224 | \c@float@type=\count289 225 | \float@exts=\toks17 226 | \float@box=\box53 227 | \@float@everytoks=\toks18 228 | \@floatcapt=\box54 229 | ) (c:/texlive/2022/texmf-dist/tex/latex/datetime/datetime.sty 230 | Package: datetime 2015/03/20 v2.60 Date Time Package 231 | (c:/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty 232 | Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW) 233 | \etb@tempcnta=\count290 234 | ) (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fmtcount.sty 235 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 236 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 237 | Package: fmtcount 2020/01/30 v3.07 238 | (c:/texlive/2022/texmf-dist/tex/latex/base/ifthen.sty 239 | Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC) 240 | ) (c:/texlive/2022/texmf-dist/tex/latex/xkeyval/xkeyval.sty 241 | Package: xkeyval 2020/11/20 v2.8 package option processing (HA) 242 | (c:/texlive/2022/texmf-dist/tex/generic/xkeyval/xkeyval.tex (c:/texlive/2022/texmf-dist/tex/generic/xkeyval/xkvutils.tex 243 | \XKV@toks=\toks19 244 | \XKV@tempa@toks=\toks20 245 | ) 246 | \XKV@depth=\count291 247 | File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) 248 | )) (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fcprefix.sty 249 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 250 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 251 | Package: fcprefix 2012/09/28 252 | (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fcnumparser.sty 253 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 254 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 255 | Package: fcnumparser 2017/06/15 256 | \fc@digit@counter=\count292 257 | )) (c:/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty 258 | File: amsgen.sty 1999/11/30 v2.0 generic functions 259 | \@emptytoks=\toks21 260 | \ex@=\dimen176 261 | ) 262 | \c@padzeroesN=\count293 263 | \fc@tmpcatcode=\count294 264 | \@DT@modctr=\count295 265 | \@ordinalctr=\count296 266 | \@orgargctr=\count297 267 | \@strctr=\count298 268 | \@tmpstrctr=\count299 269 | \@DT@loopN=\count300 270 | \@DT@X=\count301 271 | ) (c:/texlive/2022/texmf-dist/tex/latex/datetime/datetime-defaults.sty 272 | Package: datetime-defaults 2013/09/10 273 | ) 274 | \@day=\count302 275 | \@month=\count303 276 | \@year=\count304 277 | \c@HOUR=\count305 278 | \c@HOURXII=\count306 279 | \c@MINUTE=\count307 280 | \c@TOHOUR=\count308 281 | \c@TOMINUTE=\count309 282 | \c@SECOND=\count310 283 | \currenthour=\count311 284 | \currentminute=\count312 285 | \currentsecond=\count313 286 | Package datetime Info: No datetime.cfg file found, using default settings on input line 308. 287 | \@dtctr=\count314 288 | \dayofyear=\count315 289 | \dayofweek=\count316 290 | LaTeX Info: Redefining \today on input line 736. 291 | \dt@a=\toks22 292 | \dt@b=\toks23 293 | ) (c:/texlive/2022/texmf-dist/tex/latex/hyperref/hyperref.sty 294 | Package: hyperref 2022-02-21 v7.00n Hypertext links for LaTeX 295 | (c:/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty 296 | Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO) 297 | ) (c:/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty 298 | Package: iftex 2022/02/03 v1.0f TeX engine tests 299 | ) (c:/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty 300 | Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO) 301 | (c:/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty 302 | Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO) 303 | ) 304 | Package pdftexcmds Info: \pdf@primitive is available. 305 | Package pdftexcmds Info: \pdf@ifprimitive is available. 306 | Package pdftexcmds Info: \pdfdraftmode not found. 307 | ) (c:/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty 308 | Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO) 309 | ) (c:/texlive/2022/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty 310 | Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO) 311 | ) (c:/texlive/2022/texmf-dist/tex/generic/pdfescape/pdfescape.sty 312 | Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO) 313 | ) (c:/texlive/2022/texmf-dist/tex/latex/hycolor/hycolor.sty 314 | Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO) 315 | ) (c:/texlive/2022/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty 316 | Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO) 317 | ) (c:/texlive/2022/texmf-dist/tex/latex/auxhook/auxhook.sty 318 | Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO) 319 | ) (c:/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty 320 | Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO) 321 | ) 322 | \@linkdim=\dimen177 323 | \Hy@linkcounter=\count317 324 | \Hy@pagecounter=\count318 325 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/pd1enc.def 326 | File: pd1enc.def 2022-02-21 v7.00n Hyperref: PDFDocEncoding definition (HO) 327 | ) (c:/texlive/2022/texmf-dist/tex/generic/intcalc/intcalc.sty 328 | Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO) 329 | ) (c:/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty 330 | Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO) 331 | ) 332 | \Hy@SavedSpaceFactor=\count319 333 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/puenc.def 334 | File: puenc.def 2022-02-21 v7.00n Hyperref: PDF Unicode definition (HO) 335 | ) 336 | Package hyperref Info: Option `unicode' set `true' on input line 4018. 337 | Package hyperref Info: Hyper figures OFF on input line 4137. 338 | Package hyperref Info: Link nesting OFF on input line 4142. 339 | Package hyperref Info: Hyper index ON on input line 4145. 340 | Package hyperref Info: Plain pages OFF on input line 4152. 341 | Package hyperref Info: Backreferencing OFF on input line 4157. 342 | Package hyperref Info: Implicit mode ON; LaTeX internals redefined. 343 | Package hyperref Info: Bookmarks ON on input line 4390. 344 | \c@Hy@tempcnt=\count320 345 | (c:/texlive/2022/texmf-dist/tex/latex/url/url.sty 346 | \Urlmuskip=\muskip17 347 | Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. 348 | ) 349 | LaTeX Info: Redefining \url on input line 4749. 350 | \XeTeXLinkMargin=\dimen178 351 | (c:/texlive/2022/texmf-dist/tex/generic/bitset/bitset.sty 352 | Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO) 353 | (c:/texlive/2022/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty 354 | Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO) 355 | )) 356 | \Fld@menulength=\count321 357 | \Field@Width=\dimen179 358 | \Fld@charsize=\dimen180 359 | Package hyperref Info: Hyper figures OFF on input line 6027. 360 | Package hyperref Info: Link nesting OFF on input line 6032. 361 | Package hyperref Info: Hyper index ON on input line 6035. 362 | Package hyperref Info: backreferencing OFF on input line 6042. 363 | Package hyperref Info: Link coloring OFF on input line 6047. 364 | Package hyperref Info: Link coloring with OCG OFF on input line 6052. 365 | Package hyperref Info: PDF/A mode OFF on input line 6057. 366 | LaTeX Info: Redefining \ref on input line 6097. 367 | LaTeX Info: Redefining \pageref on input line 6101. 368 | (c:/texlive/2022/texmf-dist/tex/latex/base/atbegshi-ltx.sty 369 | Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi 370 | package with kernel methods 371 | ) 372 | \Hy@abspage=\count322 373 | \c@Item=\count323 374 | \c@Hfootnote=\count324 375 | ) 376 | Package hyperref Info: Driver (autodetected): hxetex. 377 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/hxetex.def 378 | File: hxetex.def 2022-02-21 v7.00n Hyperref driver for XeTeX 379 | (c:/texlive/2022/texmf-dist/tex/generic/stringenc/stringenc.sty 380 | Package: stringenc 2019/11/29 v1.12 Convert strings between diff. encodings (HO) 381 | ) 382 | \pdfm@box=\box55 383 | \c@Hy@AnnotLevel=\count325 384 | \HyField@AnnotCount=\count326 385 | \Fld@listcount=\count327 386 | \c@bookmark@seq@number=\count328 387 | (c:/texlive/2022/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty 388 | Package: rerunfilecheck 2019/12/05 v1.9 Rerun checks for auxiliary files (HO) 389 | (c:/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty 390 | Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend package 391 | with kernel methods 392 | ) (c:/texlive/2022/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty 393 | Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO) 394 | ) 395 | Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 286. 396 | ) 397 | \Hy@SectionHShift=\skip57 398 | ) (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/amssymb.sty 399 | Package: amssymb 2013/01/14 v3.01 AMS font symbols 400 | (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/amsfonts.sty 401 | Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support 402 | \symAMSa=\mathgroup4 403 | \symAMSb=\mathgroup5 404 | LaTeX Font Info: Redeclaring math symbol \hbar on input line 98. 405 | LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' 406 | (Font) U/euf/m/n --> U/euf/b/n on input line 106. 407 | )) (c:/texlive/2022/texmf-dist/tex/latex/amscls/amsthm.sty 408 | Package: amsthm 2020/05/29 v2.20.6 409 | \thm@style=\toks24 410 | \thm@bodyfont=\toks25 411 | \thm@headfont=\toks26 412 | \thm@notefont=\toks27 413 | \thm@headpunct=\toks28 414 | \thm@preskip=\skip58 415 | \thm@postskip=\skip59 416 | \thm@headsep=\skip60 417 | \dth@everypar=\toks29 418 | ) 419 | \c@theorem=\count329 420 | \c@corollary=\count330 421 | \c@lemma=\count331 422 | \c@definition=\count332 423 | (c:/texlive/2022/texmf-dist/tex/latex/listings/listings.sty 424 | \lst@mode=\count333 425 | \lst@gtempboxa=\box56 426 | \lst@token=\toks30 427 | \lst@length=\count334 428 | \lst@currlwidth=\dimen181 429 | \lst@column=\count335 430 | \lst@pos=\count336 431 | \lst@lostspace=\dimen182 432 | \lst@width=\dimen183 433 | \lst@newlines=\count337 434 | \lst@lineno=\count338 435 | \lst@maxwidth=\dimen184 436 | (c:/texlive/2022/texmf-dist/tex/latex/listings/lstmisc.sty 437 | File: lstmisc.sty 2020/03/24 1.8d (Carsten Heinz) 438 | \c@lstnumber=\count339 439 | \lst@skipnumbers=\count340 440 | \lst@framebox=\box57 441 | ) (c:/texlive/2022/texmf-dist/tex/latex/listings/listings.cfg 442 | File: listings.cfg 2020/03/24 1.8d listings configuration 443 | )) 444 | Package: listings 2020/03/24 1.8d (Carsten Heinz) 445 | (c:/texlive/2022/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty 446 | Package: xeCJK-listings 2021/12/12 v3.8.8 xeCJK patch file for listings 447 | \l__xeCJK_listings_max_char_int=\count341 448 | \l__xeCJK_listings_flag_int=\count342 449 | ) (c:/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty 450 | Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK) 451 | (c:/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg 452 | File: color.cfg 2016/01/02 v1.6 sample color configuration 453 | ) 454 | Package xcolor Info: Driver file: xetex.def on input line 227. 455 | Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352. 456 | Package xcolor Info: Model `RGB' extended on input line 1368. 457 | Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370. 458 | Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371. 459 | Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372. 460 | Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373. 461 | Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374. 462 | Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375. 463 | ) (./report.aux) 464 | \openout1 = `report.aux'. 465 | 466 | LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 25. 467 | LaTeX Font Info: ... okay on input line 25. 468 | LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 25. 469 | LaTeX Font Info: ... okay on input line 25. 470 | LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 25. 471 | LaTeX Font Info: ... okay on input line 25. 472 | LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 25. 473 | LaTeX Font Info: ... okay on input line 25. 474 | LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 25. 475 | LaTeX Font Info: ... okay on input line 25. 476 | LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 25. 477 | LaTeX Font Info: ... okay on input line 25. 478 | LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 25. 479 | LaTeX Font Info: ... okay on input line 25. 480 | LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 25. 481 | LaTeX Font Info: ... okay on input line 25. 482 | LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 25. 483 | LaTeX Font Info: ... okay on input line 25. 484 | LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 25. 485 | LaTeX Font Info: ... okay on input line 25. 486 | 487 | Package fontspec Info: Adjusting the maths setup (use [no-math] to avoid 488 | (fontspec) this). 489 | 490 | \symlegacymaths=\mathgroup6 491 | LaTeX Font Info: Overwriting symbol font `legacymaths' in version `bold' 492 | (Font) OT1/cmr/m/n --> OT1/cmr/bx/n on input line 25. 493 | LaTeX Font Info: Redeclaring math accent \acute on input line 25. 494 | LaTeX Font Info: Redeclaring math accent \grave on input line 25. 495 | LaTeX Font Info: Redeclaring math accent \ddot on input line 25. 496 | LaTeX Font Info: Redeclaring math accent \tilde on input line 25. 497 | LaTeX Font Info: Redeclaring math accent \bar on input line 25. 498 | LaTeX Font Info: Redeclaring math accent \breve on input line 25. 499 | LaTeX Font Info: Redeclaring math accent \check on input line 25. 500 | LaTeX Font Info: Redeclaring math accent \hat on input line 25. 501 | LaTeX Font Info: Redeclaring math accent \dot on input line 25. 502 | LaTeX Font Info: Redeclaring math accent \mathring on input line 25. 503 | LaTeX Font Info: Redeclaring math symbol \colon on input line 25. 504 | LaTeX Font Info: Redeclaring math symbol \Gamma on input line 25. 505 | LaTeX Font Info: Redeclaring math symbol \Delta on input line 25. 506 | LaTeX Font Info: Redeclaring math symbol \Theta on input line 25. 507 | LaTeX Font Info: Redeclaring math symbol \Lambda on input line 25. 508 | LaTeX Font Info: Redeclaring math symbol \Xi on input line 25. 509 | LaTeX Font Info: Redeclaring math symbol \Pi on input line 25. 510 | LaTeX Font Info: Redeclaring math symbol \Sigma on input line 25. 511 | LaTeX Font Info: Redeclaring math symbol \Upsilon on input line 25. 512 | LaTeX Font Info: Redeclaring math symbol \Phi on input line 25. 513 | LaTeX Font Info: Redeclaring math symbol \Psi on input line 25. 514 | LaTeX Font Info: Redeclaring math symbol \Omega on input line 25. 515 | LaTeX Font Info: Redeclaring math symbol \mathdollar on input line 25. 516 | LaTeX Font Info: Redeclaring symbol font `operators' on input line 25. 517 | LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font 518 | (Font) `operators' in the math version `normal' on input line 25. 519 | LaTeX Font Info: Overwriting symbol font `operators' in version `normal' 520 | (Font) OT1/cmr/m/n --> TU/lmr/m/n on input line 25. 521 | LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font 522 | (Font) `operators' in the math version `bold' on input line 25. 523 | LaTeX Font Info: Overwriting symbol font `operators' in version `bold' 524 | (Font) OT1/cmr/bx/n --> TU/lmr/m/n on input line 25. 525 | LaTeX Font Info: Overwriting symbol font `operators' in version `normal' 526 | (Font) TU/lmr/m/n --> TU/lmr/m/n on input line 25. 527 | LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal' 528 | (Font) OT1/cmr/m/it --> TU/lmr/m/it on input line 25. 529 | LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal' 530 | (Font) OT1/cmr/bx/n --> TU/lmr/b/n on input line 25. 531 | LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `normal' 532 | (Font) OT1/cmss/m/n --> TU/lmss/m/n on input line 25. 533 | LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `normal' 534 | (Font) OT1/cmtt/m/n --> TU/lmtt/m/n on input line 25. 535 | LaTeX Font Info: Overwriting symbol font `operators' in version `bold' 536 | (Font) TU/lmr/m/n --> TU/lmr/b/n on input line 25. 537 | LaTeX Font Info: Overwriting math alphabet `\mathit' in version `bold' 538 | (Font) OT1/cmr/bx/it --> TU/lmr/b/it on input line 25. 539 | LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `bold' 540 | (Font) OT1/cmss/bx/n --> TU/lmss/b/n on input line 25. 541 | LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `bold' 542 | (Font) OT1/cmtt/m/n --> TU/lmtt/b/n on input line 25. 543 | (c:/texlive/2022/texmf-dist/tex/latex/fmtcount/fc-english.def 544 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 545 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 546 | File: fc-english.def 2016/01/12 547 | ) 548 | Package hyperref Info: Link coloring OFF on input line 25. 549 | (c:/texlive/2022/texmf-dist/tex/latex/hyperref/nameref.sty 550 | Package: nameref 2021-04-02 v2.47 Cross-referencing by name of section 551 | (c:/texlive/2022/texmf-dist/tex/latex/refcount/refcount.sty 552 | Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO) 553 | ) (c:/texlive/2022/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty 554 | Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO) 555 | ) 556 | \c@section@level=\count343 557 | ) 558 | LaTeX Info: Redefining \ref on input line 25. 559 | LaTeX Info: Redefining \pageref on input line 25. 560 | LaTeX Info: Redefining \nameref on input line 25. 561 | (./report.out) (./report.out) 562 | \@outlinefile=\write3 563 | \openout3 = `report.out'. 564 | 565 | \c@lstlisting=\count344 566 | LaTeX Font Info: Trying to load font information for U+msa on input line 28. 567 | (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/umsa.fd 568 | File: umsa.fd 2013/01/14 v3.01 AMS symbols A 569 | ) 570 | LaTeX Font Info: Trying to load font information for U+msb on input line 28. 571 | (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/umsb.fd 572 | File: umsb.fd 2013/01/14 v3.01 AMS symbols B 573 | ) [1 574 | 575 | ] (./report.toc) 576 | \tf@toc=\write4 577 | \openout4 = `report.toc'. 578 | 579 | [2] 580 | File: figure/1.png Graphic file (type bmp) 581 |
582 | [3] [4] [5] [6] (./report.aux) 583 | Package rerunfilecheck Info: File `report.out' has not changed. 584 | (rerunfilecheck) Checksum: F76199530F16F69B494548DDDEDAC6FF;981. 585 | ) 586 | Here is how much of TeX's memory you used: 587 | 17079 strings out of 476179 588 | 347699 string characters out of 5813072 589 | 703529 words of memory out of 5000000 590 | 37548 multiletter control sequences out of 15000+600000 591 | 478961 words of font info for 88 fonts, out of 8000000 for 9000 592 | 1348 hyphenation exceptions out of 8191 593 | 89i,6n,97p,1005b,334s stack positions out of 10000i,1000n,20000p,200000b,200000s 594 | 595 | Output written on report.pdf (6 pages). 596 | -------------------------------------------------------------------------------- /Assignment/Assignment3/report.out: -------------------------------------------------------------------------------- 1 | \BOOKMARK [1][-]{section.1}{\376\377\000C\000o\000n\000v\000e\000r\000t\000i\000n\000g\000\040\000s\000i\000g\000n\000a\000l\000s}{}% 1 2 | \BOOKMARK [1][-]{section.2}{\376\377\000A\000r\000b\000i\000t\000r\000a\000r\000y\000-\000p\000r\000e\000c\000i\000s\000i\000o\000n\000\040\000m\000u\000l\000t\000i\000p\000l\000i\000c\000a\000t\000i\000o\000n}{}% 2 3 | \BOOKMARK [1][-]{section.3}{\376\377\000M\000o\000r\000e\000\040\000a\000p\000p\000l\000i\000c\000a\000t\000i\000o\000n\000s}{}% 3 4 | \BOOKMARK [2][-]{subsection.3.1}{\376\377\000A\000u\000d\000i\000o\000\040\000e\000d\000i\000t\000i\000n\000g}{section.3}% 4 5 | \BOOKMARK [2][-]{subsection.3.2}{\376\377\000I\000m\000a\000g\000e\000\040\000c\000o\000m\000p\000r\000e\000s\000s\000i\000o\000n}{section.3}% 5 6 | \BOOKMARK [2][-]{subsection.3.3}{\376\377\000C\000o\000m\000p\000u\000t\000e\000r\000\040\000v\000i\000s\000i\000o\000n}{section.3}% 6 7 | \BOOKMARK [1][-]{section.4}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 7 8 | -------------------------------------------------------------------------------- /Assignment/Assignment3/report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment3/report.pdf -------------------------------------------------------------------------------- /Assignment/Assignment3/report.synctex.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment3/report.synctex.gz -------------------------------------------------------------------------------- /Assignment/Assignment3/report.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{ctex} 4 | \usepackage{graphicx} 5 | \usepackage{float} 6 | \usepackage{datetime} 7 | \usepackage{hyperref} 8 | \usepackage{amssymb} 9 | \usepackage{amsthm} 10 | \newtheorem{theorem}{Theorem} 11 | \newtheorem{corollary}{Colollary} 12 | \newtheorem{lemma}{Lemma} 13 | \newtheorem{definition}{Definition} 14 | \renewcommand\proofname{Proof} 15 | \renewcommand\figurename{Figure} 16 | \usepackage{listings} 17 | \usepackage{xcolor} 18 | 19 | \title{CS216 Assignment3 \\ {\begin{large} Applications and Variants of FFT Algorithm \end{large}}} 20 | 21 | \author{匡亮(12111012)} 22 | 23 | \date{April 21, 2023} 24 | 25 | \begin{document} 26 | 27 | \maketitle 28 | 29 | \renewcommand\abstractname{Abstract} 30 | \begin{abstract} 31 | 32 | This is my report of CS216 Assignment3, including several applications of FFT: 33 | 34 | \begin{itemize} 35 | \item [1.] Converting signals between time domain and frequency domain. 36 | \item [2.] Arbitrary-precision multiplication. 37 | \item [3.] More applications of FFT in sound and image processing and AI. 38 | \end{itemize} 39 | 40 | \end{abstract} 41 | 42 | \newpage % contents page 43 | 44 | \renewcommand\contentsname{Contents} 45 | \tableofcontents 46 | 47 | \newpage % 1st page here 48 | 49 | \section{Converting signals} 50 | 51 | The core idea of this section is to look at the other viewpoint that we skipped in class. 52 | 53 | \begin{figure}[h] % 'h' means insert here 54 | \centering 55 | \includegraphics[height=7cm,width=11cm]{figure/1.png} 56 | \caption{Lecture07-dnc-multiplication-and-fft.pdf Page20} 57 | \label{1} 58 | \end{figure} 59 | 60 | A \textbf{time-domain} graph shows how a signal changes over time, whereas a \textbf{frequency-domain} graph shows how much of the signal lies within each given frequency band over a range of frequencies. A time-domain graph is often more intuitive but complex and hard to modify, so we want a quick method to change a signal between time-domain and frequency-domain. 61 | 62 | By \textbf{fourier expansion}, we know that a period funtion $f(x)=f(x+T)$ can be expand to $f(t)=\sum_{n=-\infty}^{+\infty}c_ne^{in\omega t},c_n=\frac{1}{T}\int_{0}^{T}f(t)e^{-in\omega t}dt$. So, if our signal is the sum of some trigonometric functions with the same base frequency (i.e. their frequency are in the set $\{\omega,2\omega,3\omega,...,n\omega\}$), then, to change between time-domain and frequency-domain equals to transform between the function $f(x)$ and its corresponding sequence $c$. 63 | 64 | Look at the two equations above, it is not hard to find that transform between $f(x)$ and sequence $c$ is DFT and IDFT, therefore we can use FFT to speed up this procedure. So far, we have a quick method to split a signal into several basic waves. In the third section we will introduce more applications of this method. 65 | 66 | \section{Arbitrary-precision multiplication} 67 | 68 | We have learned in the lecture that we can use FFT to convert a polynomial between its coefficient representation and point-value representation, which can speed up multiplication of two polynomials. Then if we let $x=10$ and use a polynomial to represent a large number, we can use FFT to compute the product of two large numbers. However, FFT uses floating point numbers to represent complex numbers in its calculation, which is slow, redundant and imprecise sometimes. So in this section, I will introduce a variant of FFT, called \textbf{NTT (Number-Theoretic Transform)}, which only use integer in its calcualtion. 69 | 70 | Let's first recall why we need complex numbers in FFT. When we divide $A(x)=a_0+a_1x+a_2x^2+a_3x^3...$ into $A_{even}(x)=a_0+a_2x+...$ and $A_{odd}(x)=a_1+a_3x+...$, then calculate $A(x)$ by $A(x)=A_{even}(x^2)+xA_{odd}(x^2),A(-x)=A_{even}(x^2)-xA_{odd}(x^2)$, we want the points we chose are still pairwise negative after we squared them, which is impossible in integer domain, but possible in complex domain. However, if all coefficients in the polynomial are integers, such property is also possible in modulo domain. 71 | 72 | By Fermat's little theorem, we konw that $a^{p-1}\equiv 1\bmod p$ when $p$ is a prime number and $0>} 19 | \providecommand \oddpage@label [2]{} 20 | \@writefile{toc}{\contentsline {section}{\numberline {1}Core idea and critical procedures of Tarjan's trick}{3}{section.1}\protected@file@percent } 21 | \@writefile{toc}{\contentsline {section}{\numberline {2}Running time and space complexity analysis}{3}{section.2}\protected@file@percent } 22 | \@writefile{toc}{\contentsline {section}{\numberline {3}Pseudocode}{4}{section.3}\protected@file@percent } 23 | \@writefile{loa}{\contentsline {algocf}{\numberline {1}{\ignorespaces SPFA Improved by Tarjan's Trick}}{4}{algocf.1}\protected@file@percent } 24 | \@writefile{toc}{\contentsline {section}{\numberline {4}How it speeds up SPFA}{4}{section.4}\protected@file@percent } 25 | \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces An example forcing SPFA to run for $\Omega (nm)$ time.}}{5}{figure.1}\protected@file@percent } 26 | \newlabel{1}{{1}{5}{An example forcing SPFA to run for $\Omega (nm)$ time}{figure.1}{}} 27 | \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces An explanation for why SPFA runs slowly on this example.}}{5}{figure.2}\protected@file@percent } 28 | \newlabel{2}{{2}{5}{An explanation for why SPFA runs slowly on this example}{figure.2}{}} 29 | \bibcite{textbook}{Jon Kleinberg / Éva Tardos(2005)} 30 | \bibcite{article}{Stefan Lewandowski(2010)} 31 | \gdef \@abspage@last{6} 32 | -------------------------------------------------------------------------------- /Assignment/Assignment4/report.out: -------------------------------------------------------------------------------- 1 | \BOOKMARK [1][-]{section.1}{\376\377\000C\000o\000r\000e\000\040\000i\000d\000e\000a\000\040\000a\000n\000d\000\040\000c\000r\000i\000t\000i\000c\000a\000l\000\040\000p\000r\000o\000c\000e\000d\000u\000r\000e\000s\000\040\000o\000f\000\040\000T\000a\000r\000j\000a\000n\000'\000s\000\040\000t\000r\000i\000c\000k}{}% 1 2 | \BOOKMARK [1][-]{section.2}{\376\377\000R\000u\000n\000n\000i\000n\000g\000\040\000t\000i\000m\000e\000\040\000a\000n\000d\000\040\000s\000p\000a\000c\000e\000\040\000c\000o\000m\000p\000l\000e\000x\000i\000t\000y\000\040\000a\000n\000a\000l\000y\000s\000i\000s}{}% 2 3 | \BOOKMARK [1][-]{section.3}{\376\377\000P\000s\000e\000u\000d\000o\000c\000o\000d\000e}{}% 3 4 | \BOOKMARK [1][-]{section.4}{\376\377\000H\000o\000w\000\040\000i\000t\000\040\000s\000p\000e\000e\000d\000s\000\040\000u\000p\000\040\000S\000P\000F\000A}{}% 4 5 | -------------------------------------------------------------------------------- /Assignment/Assignment4/report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment4/report.pdf -------------------------------------------------------------------------------- /Assignment/Assignment4/report.synctex.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment4/report.synctex.gz -------------------------------------------------------------------------------- /Assignment/Assignment4/report.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{ctex} 4 | \usepackage{graphicx} 5 | \usepackage{float} 6 | \usepackage{datetime} 7 | \usepackage{hyperref} 8 | \usepackage{amssymb} 9 | \usepackage{amsthm} 10 | \newtheorem{theorem}{Theorem} 11 | \newtheorem{corollary}{Colollary} 12 | \newtheorem{lemma}{Lemma} 13 | \newtheorem{definition}{Definition} 14 | \renewcommand\proofname{Proof} 15 | \renewcommand\figurename{Figure} 16 | \usepackage{listings} 17 | \usepackage{xcolor} 18 | \usepackage[linesnumbered, ruled]{algorithm2e} 19 | \usepackage[legalpaper, margin=1.4in]{geometry} 20 | 21 | \title{CS216 Assignment4 \\ {\begin{large} Description of the subtree disassembly trick proposed by Tarjan \end{large}}} %title 22 | 23 | \author{匡亮(12111012)} 24 | 25 | \date{May 1, 2023} % date 26 | 27 | \begin{document} 28 | 29 | \maketitle 30 | 31 | \renewcommand\abstractname{Abstract} 32 | \begin{abstract} 33 | 34 | This is my report of CS216 Assignment4, including a description of the subtree disassembly trick proposed by Tarjan: 35 | 36 | \begin{itemize} 37 | \item[1.] Its core idea and critical procedures. 38 | \item[2.] Running time and space complexity analysis. 39 | \item[3.] Its pseudocode. 40 | \item[4.] How it speeds up SPFA. 41 | \end{itemize} 42 | 43 | \end{abstract} 44 | 45 | \newpage % contents page 46 | 47 | \renewcommand\contentsname{Contents} 48 | \tableofcontents 49 | 50 | \newpage % 1st page here 51 | 52 | \section{Core idea and critical procedures of Tarjan's trick} 53 | 54 | For convenience, in the whole report we assume the terminus vertex $t$ is reachable from every vertex in $G$, and our algorithm will immediately terminate if we find a negative ring (though some vertices cannot reach it, which means they still have a valid non-infinite minimum distance to the terminus vertex). Under these conditions, Tarjan's trick can significantly speed up SPFA without change the algorithm a lot. 55 | 56 | Here I don't repeat what we have learned in our courses (like how SPFA works) and begin from SPFA. 57 | 58 | In SPFA, we maintain an array $first$ for each vertex, and check whether there is a ring after $n$ iterations to determine whether there is a negative ring. However, if we have found a ring during the iterations, we can immediately terminate the algorithm and report there is a negative ring. Therefore, the basic idea of this trick is try to detect whether there is a ring when modifying $first$ with an acceptable extra cost. 59 | 60 | Obviously, before we find a ring, $(v, first[v]),\forall v\not=t$ is a tree with root $t$. When we set $first[v]\leftarrow w$, we can do DFS in $v$'s subtree and check whether $w$ is in $v$'s subtree, if so, we can terminate our algorithm. However, this DFS will cost an extra $O(n)$ time, so we should expect it to do more for us. We can further observe that before the modification, the minimum distance of all vertices in $v$'s subtree (call them $x$) is evaluated based on the minimum distance of $v$, which has been just modified. Therefore, the minimum distance of all of them are out of date. We can set them \textbf{dormant}, then they will not be used to update others' minimum distance before their own minimum distance are updated. At the same time we can remove them from the tree (set $first[x]\leftarrow null$), so that they will not be set dormant by other ancestors again. They will add themselves back to the tree automatically when their minimum distance are updated (because they will update $first[x]$ at that time). 61 | 62 | \section{Running time and space complexity analysis} 63 | 64 | Based on SPFA, we just store one more tree with $O(1)$ space per vertex, so the space complexity is still $O(n)$. 65 | 66 | Add/Remove a vertex to/from the tree can be easily done in $O(1)$ time with linked-list. Adding only happens when $first[v]$ are updated for some $v$, and removing happens no more than adding because vertices will not be removed twice, so the time complexity is still $O(nm)$. 67 | 68 | \newpage 69 | 70 | \section{Pseudocode} 71 | 72 | \begin{algorithm} 73 | \KwData{G, t} 74 | $n=$ number of nodes in $G$\; 75 | $foundNegativeRing=$ False\; 76 | Array $M[V]$\; 77 | Initialize $M[t]=0$ and $M[v]=\infty$ for all other $v\in V$\; 78 | Initialize $first[t]=t$ and $first[v]=null$ for all other $v\in V$\; 79 | Initialize a tree with only root vertex $t$\; 80 | Set all vertices except $t$ dormant in the first iteration\; 81 | \For {$i=1,...,n-1$} { 82 | Set all vertices dormant in next iteration\; 83 | \For {$w\in V$ where $w$ is not dormant in this iteration} { 84 | \For {all edges $(v,w)$} { 85 | $M[v]=\min(M[v],c_{vw}+W[w])$\; 86 | \If {this change the value of $M[v]$} { 87 | $first[v]=w$\; 88 | \For {all vertex $x$ in $v$'s subtree} { 89 | \If {$x$ is equal to $w$} { 90 | $foundNegativeRing=$ True\; 91 | End the algorithm\; 92 | } 93 | Set $x$ dormant in next iteration\; 94 | Remove $x$ from the tree\; 95 | } 96 | Set $v$ not dormant in next iteration\; 97 | Add $v$ to the tree as $w$'s child\; 98 | } 99 | } 100 | } 101 | \If {no value changed in this iteration} { 102 | End the algorithm\; 103 | } 104 | \tcc { If $foundNegativeRing$ is true, then users should ignore the returned $M,first$. } 105 | } 106 | \KwResult{$foundNegativeRing,M,first$} 107 | \caption{SPFA Improved by Tarjan's Trick} 108 | \end{algorithm} 109 | 110 | \section{How it speeds up SPFA} 111 | 112 | If there is a negative ring, the algorithm will terminate in advance, so it is speeded up without a doubt. 113 | 114 | Even if there is no negative rings, this trick can still speed SPFA up. \textbf{Figure 1.} below shows a classic example. 115 | 116 | \begin{figure}[h] % 'h' means insert here 117 | \centering 118 | \includegraphics[height=2cm,width=8cm]{figure/1.png} 119 | \caption{An example forcing SPFA to run for $\Omega(nm)$ time.} 120 | \label{1} 121 | \end{figure} 122 | 123 | In this example, the terminus vertex is on the leftmost, and the orange numbers are weights. If we update all vertices from left to right, we will always first update the vertex on the lower left corner of a triangle, and then the vertex on the upper angle, which will update the vertex on the lower left corner in the next iteration. In short, the vertices on the lower layer have been always misleading in the whole procedure. Actually, in the $a$th round for $a<\frac{n}{2}$, there are $2a-1$ vertices being updated in the last iteration. However, if we use Tarjan's trick, there will always be $O(1)$ vertices need to be operated in each iteration. Thouth the misleading still exists, it will not bring extra cost to us because we can always immediately detect it and set the misled vertices dormant. 124 | 125 | We can think in another way. Recall that SPFA calculates the minimum distance from $v$ to $t$ with no more than $i$ edges for all vertices $v$ in the $i$th iteration. In this example, the $i$th lower layer vertex from right has $i$ different minimum distances, each of them use different numbers of edges, so its value will be changed for $i$ times during the procedure. \textbf{Figure 2.} below shows an example for $i=3$. But if we use Tarjan's trick, we will keep focusing on minimizing the final answer and ignore those useless local answer. 126 | 127 | \begin{figure}[h] % 'h' means insert here 128 | \centering 129 | \includegraphics[height=2cm,width=8cm]{figure/2.png} 130 | \caption{An explanation for why SPFA runs slowly on this example.} 131 | \label{2} 132 | \end{figure} 133 | 134 | \newpage % reference page 135 | 136 | \renewcommand\refname{References} % change '&' in the link to '\&' 137 | \begin{thebibliography}{99} 138 | \bibitem[Jon Kleinberg / Éva Tardos(2005)]{textbook} Algorithm Design (P.304 - 307) 139 | 140 | \bibitem[Stefan Lewandowski(2010)]{article} Shortest Paths and Negative Cycle Detection in Graphs with Negative Weights - I: The Bellman-Ford-Moore Algorithm Revisited 141 | https://d-nb.info/1014960916/34 142 | 143 | \end{thebibliography} 144 | 145 | \end{document} 146 | -------------------------------------------------------------------------------- /Assignment/Assignment4/report.toc: -------------------------------------------------------------------------------- 1 | \contentsline {section}{\numberline {1}Core idea and critical procedures of Tarjan's trick}{3}{section.1}% 2 | \contentsline {section}{\numberline {2}Running time and space complexity analysis}{3}{section.2}% 3 | \contentsline {section}{\numberline {3}Pseudocode}{4}{section.3}% 4 | \contentsline {section}{\numberline {4}How it speeds up SPFA}{4}{section.4}% 5 | -------------------------------------------------------------------------------- /Assignment/Assignment5/figure/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment5/figure/1.png -------------------------------------------------------------------------------- /Assignment/Assignment5/figure/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment5/figure/2.png -------------------------------------------------------------------------------- /Assignment/Assignment5/report.aux: -------------------------------------------------------------------------------- 1 | \relax 2 | \providecommand\hyper@newdestlabel[2]{} 3 | \providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} 4 | \HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined 5 | \global\let\oldnewlabel\newlabel 6 | \gdef\newlabel#1#2{\newlabelxx{#1}#2} 7 | \gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} 8 | \AtEndDocument{\ifx\hyper@anchor\@undefined 9 | \let\newlabel\oldnewlabel 10 | \fi} 11 | \fi} 12 | \global\let\hyper@last\relax 13 | \gdef\HyperFirstAtBeginDocument#1{#1} 14 | \providecommand*\HyPL@Entry[1]{} 15 | \HyPL@Entry{0<>} 16 | \providecommand \oddpage@label [2]{} 17 | \@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{3}{section.1}\protected@file@percent } 18 | \@writefile{toc}{\contentsline {subsection}{\numberline {1.1}3-SAT Problem}{3}{subsection.1.1}\protected@file@percent } 19 | \@writefile{toc}{\contentsline {subsection}{\numberline {1.2}3-Color Problem}{3}{subsection.1.2}\protected@file@percent } 20 | \@writefile{toc}{\contentsline {section}{\numberline {2}Proof}{3}{section.2}\protected@file@percent } 21 | \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces The figure 8.11 from the textbook.}}{4}{figure.1}\protected@file@percent } 22 | \newlabel{1}{{1}{4}{The figure 8.11 from the textbook}{figure.1}{}} 23 | \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces The figure 8.12 from the textbook.}}{4}{figure.2}\protected@file@percent } 24 | \newlabel{2}{{2}{4}{The figure 8.12 from the textbook}{figure.2}{}} 25 | \bibcite{textbook}{Jon Kleinberg / Éva Tardos(2005)} 26 | \gdef \@abspage@last{5} 27 | -------------------------------------------------------------------------------- /Assignment/Assignment5/report.log: -------------------------------------------------------------------------------- 1 | This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex 2023.5.10) 11 MAY 2023 12:07 2 | entering extended mode 3 | restricted \write18 enabled. 4 | file:line:error style messages enabled. 5 | %&-line parsing enabled. 6 | **report 7 | (./report.tex 8 | LaTeX2e <2022-11-01> patch level 1 9 | L3 programming layer <2023-02-22> (c:/texlive/2023/texmf-dist/tex/latex/base/article.cls 10 | Document Class: article 2022/07/02 v1.4n Standard LaTeX document class 11 | (c:/texlive/2023/texmf-dist/tex/latex/base/size10.clo 12 | File: size10.clo 2022/07/02 v1.4n Standard LaTeX file (size option) 13 | ) 14 | \c@part=\count181 15 | \c@section=\count182 16 | \c@subsection=\count183 17 | \c@subsubsection=\count184 18 | \c@paragraph=\count185 19 | \c@subparagraph=\count186 20 | \c@figure=\count187 21 | \c@table=\count188 22 | \abovecaptionskip=\skip48 23 | \belowcaptionskip=\skip49 24 | \bibindent=\dimen140 25 | ) (c:/texlive/2023/texmf-dist/tex/latex/ctex/ctex.sty (c:/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty 26 | Package: expl3 2023-02-22 L3 programming layer (loader) 27 | (c:/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-xetex.def 28 | File: l3backend-xetex.def 2023-01-16 L3 backend support: XeTeX 29 | \g__graphics_track_int=\count189 30 | \l__pdf_internal_box=\box51 31 | \g__pdf_backend_object_int=\count190 32 | \g__pdf_backend_annotation_int=\count191 33 | \g__pdf_backend_link_int=\count192 34 | )) 35 | Package: ctex 2022/07/14 v2.5.10 Chinese adapter in LaTeX (CTEX) 36 | (c:/texlive/2023/texmf-dist/tex/latex/ctex/ctexhook.sty 37 | Package: ctexhook 2022/07/14 v2.5.10 Document and package hooks (CTEX) 38 | ) (c:/texlive/2023/texmf-dist/tex/latex/ctex/ctexpatch.sty 39 | Package: ctexpatch 2022/07/14 v2.5.10 Patching commands (CTEX) 40 | ) (c:/texlive/2023/texmf-dist/tex/latex/base/fix-cm.sty 41 | Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX 42 | (c:/texlive/2023/texmf-dist/tex/latex/base/ts1enc.def 43 | File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file 44 | LaTeX Font Info: Redeclaring font encoding TS1 on input line 47. 45 | )) 46 | \l__ctex_tmp_int=\count193 47 | \l__ctex_tmp_box=\box52 48 | \l__ctex_tmp_dim=\dimen141 49 | \g__ctex_section_depth_int=\count194 50 | \g__ctex_font_size_int=\count195 51 | (c:/texlive/2023/texmf-dist/tex/latex/ctex/config/ctexopts.cfg 52 | File: ctexopts.cfg 2022/07/14 v2.5.10 Option configuration file (CTEX) 53 | ) (c:/texlive/2023/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def 54 | File: ctex-engine-xetex.def 2022/07/14 v2.5.10 XeLaTeX adapter (CTEX) 55 | (c:/texlive/2023/texmf-dist/tex/xelatex/xecjk/xeCJK.sty 56 | Package: xeCJK 2022/08/05 v3.9.1 Typesetting CJK scripts with XeLaTeX 57 | (c:/texlive/2023/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty 58 | Package: xtemplate 2023-02-02 L3 Experimental prototype document functions 59 | \l__xtemplate_tmp_dim=\dimen142 60 | \l__xtemplate_tmp_int=\count196 61 | \l__xtemplate_tmp_muskip=\muskip16 62 | \l__xtemplate_tmp_skip=\skip50 63 | ) 64 | \l__xeCJK_tmp_int=\count197 65 | \l__xeCJK_tmp_box=\box53 66 | \l__xeCJK_tmp_dim=\dimen143 67 | \l__xeCJK_tmp_skip=\skip51 68 | \g__xeCJK_space_factor_int=\count198 69 | \l__xeCJK_begin_int=\count199 70 | \l__xeCJK_end_int=\count266 71 | \c__xeCJK_CJK_class_int=\XeTeXcharclass1 72 | \c__xeCJK_FullLeft_class_int=\XeTeXcharclass2 73 | \c__xeCJK_FullRight_class_int=\XeTeXcharclass3 74 | \c__xeCJK_HalfLeft_class_int=\XeTeXcharclass4 75 | \c__xeCJK_HalfRight_class_int=\XeTeXcharclass5 76 | \c__xeCJK_NormalSpace_class_int=\XeTeXcharclass6 77 | \c__xeCJK_CM_class_int=\XeTeXcharclass7 78 | \c__xeCJK_HangulJamo_class_int=\XeTeXcharclass8 79 | \l__xeCJK_last_skip=\skip52 80 | \c__xeCJK_none_node=\count267 81 | \g__xeCJK_node_int=\count268 82 | \c__xeCJK_CJK_node_dim=\dimen144 83 | \c__xeCJK_CJK-space_node_dim=\dimen145 84 | \c__xeCJK_default_node_dim=\dimen146 85 | \c__xeCJK_CJK-widow_node_dim=\dimen147 86 | \c__xeCJK_normalspace_node_dim=\dimen148 87 | \c__xeCJK_default-space_node_skip=\skip53 88 | \l__xeCJK_ccglue_skip=\skip54 89 | \l__xeCJK_ecglue_skip=\skip55 90 | \l__xeCJK_punct_kern_skip=\skip56 91 | \l__xeCJK_indent_box=\box54 92 | \l__xeCJK_last_penalty_int=\count269 93 | \l__xeCJK_last_bound_dim=\dimen149 94 | \l__xeCJK_last_kern_dim=\dimen150 95 | \l__xeCJK_widow_penalty_int=\count270 96 | 97 | Package xtemplate Info: Declaring object type 'xeCJK/punctuation' taking 0 98 | (xtemplate) argument(s) on line 2396. 99 | 100 | \l__xeCJK_fixed_punct_width_dim=\dimen151 101 | \l__xeCJK_mixed_punct_width_dim=\dimen152 102 | \l__xeCJK_middle_punct_width_dim=\dimen153 103 | \l__xeCJK_fixed_margin_width_dim=\dimen154 104 | \l__xeCJK_mixed_margin_width_dim=\dimen155 105 | \l__xeCJK_middle_margin_width_dim=\dimen156 106 | \l__xeCJK_bound_punct_width_dim=\dimen157 107 | \l__xeCJK_bound_margin_width_dim=\dimen158 108 | \l__xeCJK_margin_minimum_dim=\dimen159 109 | \l__xeCJK_kerning_total_width_dim=\dimen160 110 | \l__xeCJK_same_align_margin_dim=\dimen161 111 | \l__xeCJK_different_align_margin_dim=\dimen162 112 | \l__xeCJK_kerning_margin_width_dim=\dimen163 113 | \l__xeCJK_kerning_margin_minimum_dim=\dimen164 114 | \l__xeCJK_bound_dim=\dimen165 115 | \l__xeCJK_reverse_bound_dim=\dimen166 116 | \l__xeCJK_margin_dim=\dimen167 117 | \l__xeCJK_minimum_bound_dim=\dimen168 118 | \l__xeCJK_kerning_margin_dim=\dimen169 119 | \g__xeCJK_family_int=\count271 120 | \l__xeCJK_fam_int=\count272 121 | \g__xeCJK_fam_allocation_int=\count273 122 | \l__xeCJK_verb_case_int=\count274 123 | \l__xeCJK_verb_exspace_skip=\skip57 124 | (c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.sty (c:/texlive/2023/texmf-dist/tex/latex/l3packages/xparse/xparse.sty 125 | Package: xparse 2023-02-02 L3 Experimental document command parser 126 | ) 127 | Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX 128 | (c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty 129 | Package: fontspec-xetex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX 130 | \l__fontspec_script_int=\count275 131 | \l__fontspec_language_int=\count276 132 | \l__fontspec_strnum_int=\count277 133 | \l__fontspec_tmp_int=\count278 134 | \l__fontspec_tmpa_int=\count279 135 | \l__fontspec_tmpb_int=\count280 136 | \l__fontspec_tmpc_int=\count281 137 | \l__fontspec_em_int=\count282 138 | \l__fontspec_emdef_int=\count283 139 | \l__fontspec_strong_int=\count284 140 | \l__fontspec_strongdef_int=\count285 141 | \l__fontspec_tmpa_dim=\dimen170 142 | \l__fontspec_tmpb_dim=\dimen171 143 | \l__fontspec_tmpc_dim=\dimen172 144 | (c:/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty 145 | Package: fontenc 2021/04/29 v2.0v Standard LaTeX package 146 | ) (c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (c:/texlive/2023/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg 147 | File: xeCJK.cfg 2022/08/05 v3.9.1 Configuration file for xeCJK package 148 | )) 149 | \ccwd=\dimen173 150 | \l__ctex_ccglue_skip=\skip58 151 | ) 152 | \l__ctex_ziju_dim=\dimen174 153 | (c:/texlive/2023/texmf-dist/tex/latex/zhnumber/zhnumber.sty 154 | Package: zhnumber 2022/07/14 v3.0 Typesetting numbers with Chinese glyphs 155 | \l__zhnum_scale_int=\count286 156 | \l__zhnum_tmp_int=\count287 157 | (c:/texlive/2023/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg 158 | File: zhnumber-utf8.cfg 2022/07/14 v3.0 Chinese numerals with UTF8 encoding 159 | )) (c:/texlive/2023/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def 160 | File: ctex-scheme-chinese.def 2022/07/14 v2.5.10 Chinese scheme for generic (CTEX) 161 | (c:/texlive/2023/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg 162 | File: ctex-name-utf8.cfg 2022/07/14 v2.5.10 Caption with encoding UTF-8 (CTEX) 163 | )) (c:/texlive/2023/texmf-dist/tex/latex/tools/indentfirst.sty 164 | Package: indentfirst 1995/11/23 v1.03 Indent first paragraph (DPC) 165 | ) (c:/texlive/2023/texmf-dist/tex/latex/ctex/ctex-c5size.clo 166 | File: ctex-c5size.clo 2022/07/14 v2.5.10 c5size option (CTEX) 167 | ) (c:/texlive/2023/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def 168 | File: ctex-fontset-windows.def 2022/07/14 v2.5.10 Windows fonts definition (CTEX) 169 | 170 | Package fontspec Info: Could not resolve font "KaiTi/B" (it probably doesn't 171 | (fontspec) exist). 172 | 173 | 174 | Package fontspec Info: Could not resolve font "SimHei/I" (it probably doesn't 175 | (fontspec) exist). 176 | 177 | 178 | Package fontspec Info: Could not resolve font "SimSun/BI" (it probably doesn't 179 | (fontspec) exist). 180 | 181 | 182 | Package fontspec Info: Font family 'SimSun(0)' created for font 'SimSun' with 183 | (fontspec) options 184 | (fontspec) [Script={CJK},BoldFont={SimHei},ItalicFont={KaiTi}]. 185 | (fontspec) 186 | (fontspec) This font family consists of the following NFSS 187 | (fontspec) series/shapes: 188 | (fontspec) 189 | (fontspec) - 'normal' (m/n) with NFSS spec.: 190 | (fontspec) <->"SimSun/OT:script=hani;language=dflt;" 191 | (fontspec) - 'small caps' (m/sc) with NFSS spec.: 192 | (fontspec) - 'bold' (b/n) with NFSS spec.: 193 | (fontspec) <->"SimHei/OT:script=hani;language=dflt;" 194 | (fontspec) - 'bold small caps' (b/sc) with NFSS spec.: 195 | (fontspec) - 'italic' (m/it) with NFSS spec.: 196 | (fontspec) <->"KaiTi/OT:script=hani;language=dflt;" 197 | (fontspec) - 'italic small caps' (m/scit) with NFSS spec.: 198 | 199 | )) (c:/texlive/2023/texmf-dist/tex/latex/ctex/config/ctex.cfg 200 | File: ctex.cfg 2022/07/14 v2.5.10 Configuration file (CTEX) 201 | ) (c:/texlive/2023/texmf-dist/tex/latex/graphics/graphicx.sty 202 | Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR) 203 | (c:/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty 204 | Package: keyval 2022/05/29 v1.15 key=value parser (DPC) 205 | \KV@toks@=\toks16 206 | ) (c:/texlive/2023/texmf-dist/tex/latex/graphics/graphics.sty 207 | Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR) 208 | (c:/texlive/2023/texmf-dist/tex/latex/graphics/trig.sty 209 | Package: trig 2021/08/11 v1.11 sin cos tan (DPC) 210 | ) (c:/texlive/2023/texmf-dist/tex/latex/graphics-cfg/graphics.cfg 211 | File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration 212 | ) 213 | Package graphics Info: Driver file: xetex.def on input line 107. 214 | (c:/texlive/2023/texmf-dist/tex/latex/graphics-def/xetex.def 215 | File: xetex.def 2022/09/22 v5.0n Graphics/color driver for xetex 216 | )) 217 | \Gin@req@height=\dimen175 218 | \Gin@req@width=\dimen176 219 | ) (c:/texlive/2023/texmf-dist/tex/latex/float/float.sty 220 | Package: float 2001/11/08 v1.3d Float enhancements (AL) 221 | \c@float@type=\count288 222 | \float@exts=\toks17 223 | \float@box=\box55 224 | \@float@everytoks=\toks18 225 | \@floatcapt=\box56 226 | ) (c:/texlive/2023/texmf-dist/tex/latex/datetime/datetime.sty 227 | Package: datetime 2015/03/20 v2.60 Date Time Package 228 | (c:/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty 229 | Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW) 230 | \etb@tempcnta=\count289 231 | ) (c:/texlive/2023/texmf-dist/tex/latex/fmtcount/fmtcount.sty 232 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 233 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 234 | Package: fmtcount 2020/01/30 v3.07 235 | (c:/texlive/2023/texmf-dist/tex/latex/base/ifthen.sty 236 | Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC) 237 | ) (c:/texlive/2023/texmf-dist/tex/latex/xkeyval/xkeyval.sty 238 | Package: xkeyval 2022/06/16 v2.9 package option processing (HA) 239 | (c:/texlive/2023/texmf-dist/tex/generic/xkeyval/xkeyval.tex (c:/texlive/2023/texmf-dist/tex/generic/xkeyval/xkvutils.tex 240 | \XKV@toks=\toks19 241 | \XKV@tempa@toks=\toks20 242 | ) 243 | \XKV@depth=\count290 244 | File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) 245 | )) (c:/texlive/2023/texmf-dist/tex/latex/fmtcount/fcprefix.sty 246 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 247 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 248 | Package: fcprefix 2012/09/28 249 | (c:/texlive/2023/texmf-dist/tex/latex/fmtcount/fcnumparser.sty 250 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 251 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 252 | Package: fcnumparser 2017/06/15 253 | \fc@digit@counter=\count291 254 | )) (c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsgen.sty 255 | File: amsgen.sty 1999/11/30 v2.0 generic functions 256 | \@emptytoks=\toks21 257 | \ex@=\dimen177 258 | ) 259 | \c@padzeroesN=\count292 260 | \fc@tmpcatcode=\count293 261 | \@DT@modctr=\count294 262 | \@ordinalctr=\count295 263 | \@orgargctr=\count296 264 | \@strctr=\count297 265 | \@tmpstrctr=\count298 266 | \@DT@loopN=\count299 267 | \@DT@X=\count300 268 | ) (c:/texlive/2023/texmf-dist/tex/latex/datetime/datetime-defaults.sty 269 | Package: datetime-defaults 2013/09/10 270 | ) 271 | \@day=\count301 272 | \@month=\count302 273 | \@year=\count303 274 | \c@HOUR=\count304 275 | \c@HOURXII=\count305 276 | \c@MINUTE=\count306 277 | \c@TOHOUR=\count307 278 | \c@TOMINUTE=\count308 279 | \c@SECOND=\count309 280 | \currenthour=\count310 281 | \currentminute=\count311 282 | \currentsecond=\count312 283 | Package datetime Info: No datetime.cfg file found, using default settings on input line 308. 284 | \@dtctr=\count313 285 | \dayofyear=\count314 286 | \dayofweek=\count315 287 | LaTeX Info: Redefining \today on input line 736. 288 | \dt@a=\toks22 289 | \dt@b=\toks23 290 | ) (c:/texlive/2023/texmf-dist/tex/latex/hyperref/hyperref.sty 291 | Package: hyperref 2023-02-07 v7.00v Hypertext links for LaTeX 292 | (c:/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty 293 | Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO) 294 | ) (c:/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty 295 | Package: iftex 2022/02/03 v1.0f TeX engine tests 296 | ) (c:/texlive/2023/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty 297 | Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO) 298 | (c:/texlive/2023/texmf-dist/tex/generic/infwarerr/infwarerr.sty 299 | Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO) 300 | ) 301 | Package pdftexcmds Info: \pdf@primitive is available. 302 | Package pdftexcmds Info: \pdf@ifprimitive is available. 303 | Package pdftexcmds Info: \pdfdraftmode not found. 304 | ) (c:/texlive/2023/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty 305 | Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO) 306 | ) (c:/texlive/2023/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty 307 | Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO) 308 | ) (c:/texlive/2023/texmf-dist/tex/generic/pdfescape/pdfescape.sty 309 | Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO) 310 | ) (c:/texlive/2023/texmf-dist/tex/latex/hycolor/hycolor.sty 311 | Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO) 312 | ) (c:/texlive/2023/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty 313 | Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO) 314 | ) (c:/texlive/2023/texmf-dist/tex/latex/auxhook/auxhook.sty 315 | Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO) 316 | ) (c:/texlive/2023/texmf-dist/tex/latex/hyperref/nameref.sty 317 | Package: nameref 2022-05-17 v2.50 Cross-referencing by name of section 318 | (c:/texlive/2023/texmf-dist/tex/latex/refcount/refcount.sty 319 | Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO) 320 | ) (c:/texlive/2023/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty 321 | Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO) 322 | (c:/texlive/2023/texmf-dist/tex/latex/kvoptions/kvoptions.sty 323 | Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO) 324 | )) 325 | \c@section@level=\count316 326 | ) 327 | \@linkdim=\dimen178 328 | \Hy@linkcounter=\count317 329 | \Hy@pagecounter=\count318 330 | (c:/texlive/2023/texmf-dist/tex/latex/hyperref/pd1enc.def 331 | File: pd1enc.def 2023-02-07 v7.00v Hyperref: PDFDocEncoding definition (HO) 332 | ) (c:/texlive/2023/texmf-dist/tex/generic/intcalc/intcalc.sty 333 | Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO) 334 | ) (c:/texlive/2023/texmf-dist/tex/generic/etexcmds/etexcmds.sty 335 | Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO) 336 | ) 337 | \Hy@SavedSpaceFactor=\count319 338 | (c:/texlive/2023/texmf-dist/tex/latex/hyperref/puenc.def 339 | File: puenc.def 2023-02-07 v7.00v Hyperref: PDF Unicode definition (HO) 340 | ) 341 | Package hyperref Info: Option `unicode' set `true' on input line 4060. 342 | Package hyperref Info: Hyper figures OFF on input line 4177. 343 | Package hyperref Info: Link nesting OFF on input line 4182. 344 | Package hyperref Info: Hyper index ON on input line 4185. 345 | Package hyperref Info: Plain pages OFF on input line 4192. 346 | Package hyperref Info: Backreferencing OFF on input line 4197. 347 | Package hyperref Info: Implicit mode ON; LaTeX internals redefined. 348 | Package hyperref Info: Bookmarks ON on input line 4425. 349 | \c@Hy@tempcnt=\count320 350 | (c:/texlive/2023/texmf-dist/tex/latex/url/url.sty 351 | \Urlmuskip=\muskip17 352 | Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. 353 | ) 354 | LaTeX Info: Redefining \url on input line 4763. 355 | \XeTeXLinkMargin=\dimen179 356 | (c:/texlive/2023/texmf-dist/tex/generic/bitset/bitset.sty 357 | Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO) 358 | (c:/texlive/2023/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty 359 | Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO) 360 | )) 361 | \Fld@menulength=\count321 362 | \Field@Width=\dimen180 363 | \Fld@charsize=\dimen181 364 | Package hyperref Info: Hyper figures OFF on input line 6042. 365 | Package hyperref Info: Link nesting OFF on input line 6047. 366 | Package hyperref Info: Hyper index ON on input line 6050. 367 | Package hyperref Info: backreferencing OFF on input line 6057. 368 | Package hyperref Info: Link coloring OFF on input line 6062. 369 | Package hyperref Info: Link coloring with OCG OFF on input line 6067. 370 | Package hyperref Info: PDF/A mode OFF on input line 6072. 371 | (c:/texlive/2023/texmf-dist/tex/latex/base/atbegshi-ltx.sty 372 | Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi 373 | package with kernel methods 374 | ) 375 | \Hy@abspage=\count322 376 | \c@Item=\count323 377 | \c@Hfootnote=\count324 378 | ) 379 | Package hyperref Info: Driver (autodetected): hxetex. 380 | (c:/texlive/2023/texmf-dist/tex/latex/hyperref/hxetex.def 381 | File: hxetex.def 2023-02-07 v7.00v Hyperref driver for XeTeX 382 | (c:/texlive/2023/texmf-dist/tex/generic/stringenc/stringenc.sty 383 | Package: stringenc 2019/11/29 v1.12 Convert strings between diff. encodings (HO) 384 | ) 385 | \pdfm@box=\box57 386 | \c@Hy@AnnotLevel=\count325 387 | \HyField@AnnotCount=\count326 388 | \Fld@listcount=\count327 389 | \c@bookmark@seq@number=\count328 390 | (c:/texlive/2023/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty 391 | Package: rerunfilecheck 2022-07-10 v1.10 Rerun checks for auxiliary files (HO) 392 | (c:/texlive/2023/texmf-dist/tex/latex/base/atveryend-ltx.sty 393 | Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend package 394 | with kernel methods 395 | ) (c:/texlive/2023/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty 396 | Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO) 397 | ) 398 | Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 285. 399 | ) 400 | \Hy@SectionHShift=\skip59 401 | ) (c:/texlive/2023/texmf-dist/tex/latex/amsfonts/amssymb.sty 402 | Package: amssymb 2013/01/14 v3.01 AMS font symbols 403 | (c:/texlive/2023/texmf-dist/tex/latex/amsfonts/amsfonts.sty 404 | Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support 405 | \symAMSa=\mathgroup4 406 | \symAMSb=\mathgroup5 407 | LaTeX Font Info: Redeclaring math symbol \hbar on input line 98. 408 | LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' 409 | (Font) U/euf/m/n --> U/euf/b/n on input line 106. 410 | )) (c:/texlive/2023/texmf-dist/tex/latex/amscls/amsthm.sty 411 | Package: amsthm 2020/05/29 v2.20.6 412 | \thm@style=\toks24 413 | \thm@bodyfont=\toks25 414 | \thm@headfont=\toks26 415 | \thm@notefont=\toks27 416 | \thm@headpunct=\toks28 417 | \thm@preskip=\skip60 418 | \thm@postskip=\skip61 419 | \thm@headsep=\skip62 420 | \dth@everypar=\toks29 421 | ) 422 | \c@theorem=\count329 423 | \c@corollary=\count330 424 | \c@lemma=\count331 425 | \c@definition=\count332 426 | (c:/texlive/2023/texmf-dist/tex/latex/listings/listings.sty 427 | \lst@mode=\count333 428 | \lst@gtempboxa=\box58 429 | \lst@token=\toks30 430 | \lst@length=\count334 431 | \lst@currlwidth=\dimen182 432 | \lst@column=\count335 433 | \lst@pos=\count336 434 | \lst@lostspace=\dimen183 435 | \lst@width=\dimen184 436 | \lst@newlines=\count337 437 | \lst@lineno=\count338 438 | \lst@maxwidth=\dimen185 439 | (c:/texlive/2023/texmf-dist/tex/latex/listings/lstmisc.sty 440 | File: lstmisc.sty 2023/02/27 1.9 (Carsten Heinz) 441 | \c@lstnumber=\count339 442 | \lst@skipnumbers=\count340 443 | \lst@framebox=\box59 444 | ) (c:/texlive/2023/texmf-dist/tex/latex/listings/listings.cfg 445 | File: listings.cfg 2023/02/27 1.9 listings configuration 446 | )) 447 | Package: listings 2023/02/27 1.9 (Carsten Heinz) 448 | (c:/texlive/2023/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty 449 | Package: xeCJK-listings 2022/08/05 v3.9.1 xeCJK patch file for listings 450 | \l__xeCJK_listings_max_char_int=\count341 451 | \l__xeCJK_listings_flag_int=\count342 452 | ) (c:/texlive/2023/texmf-dist/tex/latex/xcolor/xcolor.sty 453 | Package: xcolor 2022/06/12 v2.14 LaTeX color extensions (UK) 454 | (c:/texlive/2023/texmf-dist/tex/latex/graphics-cfg/color.cfg 455 | File: color.cfg 2016/01/02 v1.6 sample color configuration 456 | ) 457 | Package xcolor Info: Driver file: xetex.def on input line 227. 458 | (c:/texlive/2023/texmf-dist/tex/latex/graphics/mathcolor.ltx) 459 | Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1353. 460 | Package xcolor Info: Model `RGB' extended on input line 1369. 461 | Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1371. 462 | Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1372. 463 | Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1373. 464 | Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1374. 465 | Package xcolor Info: Model `Gray' substituted by `gray' on input line 1375. 466 | Package xcolor Info: Model `wave' substituted by `hsb' on input line 1376. 467 | ) (c:/texlive/2023/texmf-dist/tex/latex/algorithm2e/algorithm2e.sty 468 | Invalid UTF-8 byte or sequence at line 284 replaced by U+FFFD. 469 | Invalid UTF-8 byte or sequence at line 299 replaced by U+FFFD. 470 | Invalid UTF-8 byte or sequence at line 550 replaced by U+FFFD. 471 | Package: algorithm2e 2017/07/18 v5.2 algorithms environments 472 | \c@AlgoLine=\count343 473 | \algocf@hangindent=\skip63 474 | (c:/texlive/2023/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty 475 | Package: ifoddpage 2022/10/18 v1.2 Conditionals for odd/even page detection 476 | \c@checkoddpage=\count344 477 | ) (c:/texlive/2023/texmf-dist/tex/latex/tools/xspace.sty 478 | Package: xspace 2014/10/28 v1.13 Space after command names (DPC,MH) 479 | ) (c:/texlive/2023/texmf-dist/tex/latex/relsize/relsize.sty 480 | Package: relsize 2013/03/29 ver 4.1 481 | ) 482 | \skiptotal=\skip64 483 | \skiplinenumber=\skip65 484 | \skiprule=\skip66 485 | \skiphlne=\skip67 486 | \skiptext=\skip68 487 | \skiplength=\skip69 488 | \algomargin=\skip70 489 | \skipalgocfslide=\skip71 490 | \algowidth=\dimen186 491 | \inoutsize=\dimen187 492 | \inoutindent=\dimen188 493 | \interspacetitleruled=\dimen189 494 | \interspacealgoruled=\dimen190 495 | \interspacetitleboxruled=\dimen191 496 | \algocf@ruledwidth=\skip72 497 | \algocf@inoutbox=\box60 498 | \algocf@inputbox=\box61 499 | \AlCapSkip=\skip73 500 | \AlCapHSkip=\skip74 501 | \algoskipindent=\skip75 502 | \algocf@nlbox=\box62 503 | \algocf@hangingbox=\box63 504 | \algocf@untilbox=\box64 505 | \algocf@skipuntil=\skip76 506 | \algocf@capbox=\box65 507 | \algocf@lcaptionbox=\skip77 508 | \algoheightruledefault=\skip78 509 | \algoheightrule=\skip79 510 | \algotitleheightruledefault=\skip80 511 | \algotitleheightrule=\skip81 512 | \c@algocfline=\count345 513 | \c@algocfproc=\count346 514 | \c@algocf=\count347 515 | \algocf@algoframe=\box66 516 | \algocf@algobox=\box67 517 | ) (c:/texlive/2023/texmf-dist/tex/latex/geometry/geometry.sty 518 | Package: geometry 2020/01/02 v5.9 Page Geometry 519 | (c:/texlive/2023/texmf-dist/tex/generic/iftex/ifvtex.sty 520 | Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead. 521 | ) 522 | \Gm@cnth=\count348 523 | \Gm@cntv=\count349 524 | \c@Gm@tempcnt=\count350 525 | \Gm@bindingoffset=\dimen192 526 | \Gm@wd@mp=\dimen193 527 | \Gm@odd@mp=\dimen194 528 | \Gm@even@mp=\dimen195 529 | \Gm@layoutwidth=\dimen196 530 | \Gm@layoutheight=\dimen197 531 | \Gm@layouthoffset=\dimen198 532 | \Gm@layoutvoffset=\dimen199 533 | \Gm@dimlist=\toks31 534 | ) (./report.aux) 535 | \openout1 = `report.aux'. 536 | 537 | LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 27. 538 | LaTeX Font Info: ... okay on input line 27. 539 | LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 27. 540 | LaTeX Font Info: ... okay on input line 27. 541 | LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 27. 542 | LaTeX Font Info: ... okay on input line 27. 543 | LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 27. 544 | LaTeX Font Info: ... okay on input line 27. 545 | LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 27. 546 | LaTeX Font Info: ... okay on input line 27. 547 | LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 27. 548 | LaTeX Font Info: ... okay on input line 27. 549 | LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 27. 550 | LaTeX Font Info: ... okay on input line 27. 551 | LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 27. 552 | LaTeX Font Info: ... okay on input line 27. 553 | LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 27. 554 | LaTeX Font Info: ... okay on input line 27. 555 | LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 27. 556 | LaTeX Font Info: ... okay on input line 27. 557 | 558 | Package fontspec Info: Adjusting the maths setup (use [no-math] to avoid 559 | (fontspec) this). 560 | 561 | \symlegacymaths=\mathgroup6 562 | LaTeX Font Info: Overwriting symbol font `legacymaths' in version `bold' 563 | (Font) OT1/cmr/m/n --> OT1/cmr/bx/n on input line 27. 564 | LaTeX Font Info: Redeclaring math accent \acute on input line 27. 565 | LaTeX Font Info: Redeclaring math accent \grave on input line 27. 566 | LaTeX Font Info: Redeclaring math accent \ddot on input line 27. 567 | LaTeX Font Info: Redeclaring math accent \tilde on input line 27. 568 | LaTeX Font Info: Redeclaring math accent \bar on input line 27. 569 | LaTeX Font Info: Redeclaring math accent \breve on input line 27. 570 | LaTeX Font Info: Redeclaring math accent \check on input line 27. 571 | LaTeX Font Info: Redeclaring math accent \hat on input line 27. 572 | LaTeX Font Info: Redeclaring math accent \dot on input line 27. 573 | LaTeX Font Info: Redeclaring math accent \mathring on input line 27. 574 | LaTeX Font Info: Redeclaring math symbol \colon on input line 27. 575 | LaTeX Font Info: Redeclaring math symbol \Gamma on input line 27. 576 | LaTeX Font Info: Redeclaring math symbol \Delta on input line 27. 577 | LaTeX Font Info: Redeclaring math symbol \Theta on input line 27. 578 | LaTeX Font Info: Redeclaring math symbol \Lambda on input line 27. 579 | LaTeX Font Info: Redeclaring math symbol \Xi on input line 27. 580 | LaTeX Font Info: Redeclaring math symbol \Pi on input line 27. 581 | LaTeX Font Info: Redeclaring math symbol \Sigma on input line 27. 582 | LaTeX Font Info: Redeclaring math symbol \Upsilon on input line 27. 583 | LaTeX Font Info: Redeclaring math symbol \Phi on input line 27. 584 | LaTeX Font Info: Redeclaring math symbol \Psi on input line 27. 585 | LaTeX Font Info: Redeclaring math symbol \Omega on input line 27. 586 | LaTeX Font Info: Redeclaring math symbol \mathdollar on input line 27. 587 | LaTeX Font Info: Redeclaring symbol font `operators' on input line 27. 588 | LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font 589 | (Font) `operators' in the math version `normal' on input line 27. 590 | LaTeX Font Info: Overwriting symbol font `operators' in version `normal' 591 | (Font) OT1/cmr/m/n --> TU/lmr/m/n on input line 27. 592 | LaTeX Font Info: Encoding `OT1' has changed to `TU' for symbol font 593 | (Font) `operators' in the math version `bold' on input line 27. 594 | LaTeX Font Info: Overwriting symbol font `operators' in version `bold' 595 | (Font) OT1/cmr/bx/n --> TU/lmr/m/n on input line 27. 596 | LaTeX Font Info: Overwriting symbol font `operators' in version `normal' 597 | (Font) TU/lmr/m/n --> TU/lmr/m/n on input line 27. 598 | LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal' 599 | (Font) OT1/cmr/m/it --> TU/lmr/m/it on input line 27. 600 | LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal' 601 | (Font) OT1/cmr/bx/n --> TU/lmr/b/n on input line 27. 602 | LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `normal' 603 | (Font) OT1/cmss/m/n --> TU/lmss/m/n on input line 27. 604 | LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `normal' 605 | (Font) OT1/cmtt/m/n --> TU/lmtt/m/n on input line 27. 606 | LaTeX Font Info: Overwriting symbol font `operators' in version `bold' 607 | (Font) TU/lmr/m/n --> TU/lmr/b/n on input line 27. 608 | LaTeX Font Info: Overwriting math alphabet `\mathit' in version `bold' 609 | (Font) OT1/cmr/bx/it --> TU/lmr/b/it on input line 27. 610 | LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `bold' 611 | (Font) OT1/cmss/bx/n --> TU/lmss/b/n on input line 27. 612 | LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `bold' 613 | (Font) OT1/cmtt/m/n --> TU/lmtt/b/n on input line 27. 614 | (c:/texlive/2023/texmf-dist/tex/latex/fmtcount/fc-english.def 615 | Invalid UTF-8 byte or sequence at line 10 replaced by U+FFFD. 616 | Invalid UTF-8 byte or sequence at line 22 replaced by U+FFFD. 617 | File: fc-english.def 2016/01/12 618 | ) 619 | Package hyperref Info: Link coloring OFF on input line 27. 620 | (./report.out) (./report.out) 621 | \@outlinefile=\write3 622 | \openout3 = `report.out'. 623 | 624 | \c@lstlisting=\count351 625 | 626 | *geometry* driver: auto-detecting 627 | *geometry* detected driver: xetex 628 | *geometry* verbose mode - [ preamble ] result: 629 | * driver: xetex 630 | * paper: legalpaper 631 | * layout: 632 | * layoutoffset:(h,v)=(0.0pt,0.0pt) 633 | * modes: 634 | * h-part:(L,W,R)=(101.17755pt, 411.9399pt, 101.17755pt) 635 | * v-part:(T,H,B)=(101.17755pt, 809.4249pt, 101.17755pt) 636 | * \paperwidth=614.295pt 637 | * \paperheight=1011.78pt 638 | * \textwidth=411.9399pt 639 | * \textheight=809.4249pt 640 | * \oddsidemargin=28.90756pt 641 | * \evensidemargin=28.90756pt 642 | * \topmargin=-8.09244pt 643 | * \headheight=12.0pt 644 | * \headsep=25.0pt 645 | * \topskip=10.0pt 646 | * \footskip=30.0pt 647 | * \marginparwidth=65.0pt 648 | * \marginparsep=11.0pt 649 | * \columnsep=10.0pt 650 | * \skip\footins=9.0pt plus 4.0pt minus 2.0pt 651 | * \hoffset=0.0pt 652 | * \voffset=0.0pt 653 | * \mag=1000 654 | * \@twocolumnfalse 655 | * \@twosidefalse 656 | * \@mparswitchfalse 657 | * \@reversemarginfalse 658 | * (1in=72.27pt=25.4mm, 1cm=28.453pt) 659 | 660 | LaTeX Font Info: Trying to load font information for U+msa on input line 30. 661 | (c:/texlive/2023/texmf-dist/tex/latex/amsfonts/umsa.fd 662 | File: umsa.fd 2013/01/14 v3.01 AMS symbols A 663 | ) 664 | LaTeX Font Info: Trying to load font information for U+msb on input line 30. 665 | (c:/texlive/2023/texmf-dist/tex/latex/amsfonts/umsb.fd 666 | File: umsb.fd 2013/01/14 v3.01 AMS symbols B 667 | ) [1 668 | 669 | ] (./report.toc) 670 | \tf@toc=\write4 671 | \openout4 = `report.toc'. 672 | 673 | [2] 674 | File: figure/1.png Graphic file (type bmp) 675 |
676 | 677 | 678 | LaTeX Warning: `h' float specifier changed to `ht'. 679 | 680 | File: figure/2.png Graphic file (type bmp) 681 |
682 | 683 | LaTeX Warning: `h' float specifier changed to `ht'. 684 | 685 | [3] [4] [5] (./report.aux) 686 | Package rerunfilecheck Info: File `report.out' has not changed. 687 | (rerunfilecheck) Checksum: 1649C7F9669C4117F92D0F1DB47D57E5;431. 688 | ) 689 | Here is how much of TeX's memory you used: 690 | 18834 strings out of 476683 691 | 384833 string characters out of 5807575 692 | 1863012 words of memory out of 5000000 693 | 38775 multiletter control sequences out of 15000+600000 694 | 523534 words of font info for 98 fonts, out of 8000000 for 9000 695 | 1348 hyphenation exceptions out of 8191 696 | 89i,6n,97p,1005b,335s stack positions out of 10000i,1000n,20000p,200000b,200000s 697 | 698 | Output written on report.pdf (5 pages). 699 | -------------------------------------------------------------------------------- /Assignment/Assignment5/report.out: -------------------------------------------------------------------------------- 1 | \BOOKMARK [1][-]{section.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{}% 1 2 | \BOOKMARK [2][-]{subsection.1.1}{\376\377\0003\000-\000S\000A\000T\000\040\000P\000r\000o\000b\000l\000e\000m}{section.1}% 2 3 | \BOOKMARK [2][-]{subsection.1.2}{\376\377\0003\000-\000C\000o\000l\000o\000r\000\040\000P\000r\000o\000b\000l\000e\000m}{section.1}% 3 4 | \BOOKMARK [1][-]{section.2}{\376\377\000P\000r\000o\000o\000f}{}% 4 5 | -------------------------------------------------------------------------------- /Assignment/Assignment5/report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment5/report.pdf -------------------------------------------------------------------------------- /Assignment/Assignment5/report.synctex.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Assignment/Assignment5/report.synctex.gz -------------------------------------------------------------------------------- /Assignment/Assignment5/report.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{ctex} 4 | \usepackage{graphicx} 5 | \usepackage{float} 6 | \usepackage{datetime} 7 | \usepackage{hyperref} 8 | \usepackage{amssymb} 9 | \usepackage{amsthm} 10 | \newtheorem{theorem}{Theorem} 11 | \newtheorem{corollary}{Colollary} 12 | \newtheorem{lemma}{Lemma} 13 | \newtheorem{definition}{Definition} 14 | \renewcommand\proofname{Proof} 15 | \renewcommand\figurename{Figure} 16 | \usepackage{listings} 17 | \usepackage{xcolor} 18 | \usepackage[linesnumbered, ruled]{algorithm2e} 19 | \usepackage[legalpaper, margin=1.4in]{geometry} 20 | 21 | \title{CS216 Assignment5 \\ {\begin{large} Proof of 3-SAT $\leq_p$ 3-Color \end{large}}} %title 22 | 23 | \author{匡亮(12111012)} 24 | 25 | \date{May 9, 2023} % date 26 | 27 | \begin{document} 28 | 29 | \maketitle 30 | 31 | \renewcommand\abstractname{Abstract} 32 | \begin{abstract} 33 | 34 | This is my report of CS216 Assignment5, including a proof of 3-SAT $\leq_p$ 3-Color. 35 | 36 | \end{abstract} 37 | 38 | \newpage % contents page 39 | 40 | \renewcommand\contentsname{Contents} 41 | \tableofcontents 42 | 43 | \newpage % 1st page here 44 | 45 | \section{Introduction} 46 | 47 | \subsection{3-SAT Problem} 48 | 49 | 3-SAT problem is a special case of SAT problem. Suppose we have a set $X$ of $n$ boolean variables $X=\{x_1,x_2,...,x_n\}$, each element of which can be $0$ or $1$. Use $\bar{x}$ to identify the negation of $x$. A \textbf{clause} $C$ of length $l$ is a disjunction of $l$ distinct terms $t_1\lor t_2\lor ...\lor t_n$, where $t_i\in\{x_1,x_2,...,x_n,\bar{x_1},\bar{x_2},...,\bar{x_n}\}$. A \textbf{truth assignment} is a function $v:X\to\{0,1\}$. For a collection of clause $C_1,C_2,...,C_k$, we say \textit{$v$ is the satisfying truth assignment} of them, if and only if $v$ causes all of the $C_i$ to evaluate to $1$, which means $C_1\land C_2\land ...\land C_k=1$. The problem that \textit{whether there exists a satisfying truth assignment of the given clauses} is called the \textit{SAT problem}. Specially, if all the clauses have length $l=3$, we call this problem \textit{3-SAT problem}. 50 | 51 | SAT problem is obviously an NP problem. A certificate for a yes-input is a satisfying truth assignment, with which we can calculate the value of $C_1\land ...\land C_k$ in $O(nk)$ time and check whether it equals to $1$. In fact, SAT problem is also an NPC problem but we will not prove here. 52 | 53 | \subsection{3-Color Problem} 54 | 55 | 3-Color problem, similarly, is a special case of Graph Color problem. Suppose we have a graph $G$. A \textit{k-coloring} of $G$ is a function $f:V\to\{1,2,...,k\}$ so that for every edge $(u,v)$ in $G$, we have $f(u)\not=f(v)$. If $G$ has a \textit{k-coloring}, then we will say that it is a \textit{k-colorable graph}. The problem that \textit{whether the given graph is a k-colorable graph} is called the \textit{Graph Color problem}. Specially, we call the problem with $k=3$ \textit{3-Color problem}. 56 | 57 | Graph Color problem is also an NP problem. A certificate for a yes-input is a k-coloring function $f$, with which we can check whether all edges have different colors on its two vertices in $O(|E|)$ time. In this assignment, we will problem that 3-SAT problem $\leq_p$ 3-Color problem, so if we later prove 3-SAT problem is in NPC, then we immediately know 3-Color problem is in NPC. 58 | 59 | \section{Proof} 60 | 61 | To prove this proposition, let's use a \textbf{3-Color problem solver black box} for polynomial number of times and other polynomial number of standard computational steps to solve a 3-SAT problem instance. 62 | 63 | Note that if a graph is 3-colorable, then every triangle (ring of three vertices) in it has three different colors on its three vertices. Therefore, we can build a basic graph model. We first build a triangle with three auxiliary vertices, true node, false node and base node. The base node will automatically take a color different from the true node and false node, so similarly, we then build a triangle with $v_i$, $\bar{v_i}$ and base node for $1\le i\le n$. Therefore, one of them will take the same color with the true node, and the other will take the same color with the false node. 64 | 65 | \begin{figure}[h] 66 | \centering 67 | \includegraphics[height=7cm,width=8cm]{figure/1.png} 68 | \caption{The figure 8.11 from the textbook.} 69 | \label{1} 70 | \end{figure} 71 | 72 | Then, let's build a subgraph for each clause, to ensure that the subgraph is 3-colorable if and only if the clause can be true. The subgraph is showed below for an example $C_i=v_1\lor\bar{v_2}\lor v_3$, and we can easily enumerate the eight cases and find that the subgraph is 3-colorable if and only if at least one of them is true. 73 | 74 | \begin{figure}[h] 75 | \centering 76 | \includegraphics[height=6cm,width=8cm]{figure/2.png} 77 | \caption{The figure 8.12 from the textbook.} 78 | \label{2} 79 | \end{figure} 80 | 81 | Now, we can build the basic graph and the subgraph for all the clauses, and use the black box to give it a 3-color or tell us that there is no solution. If the black box gives us a solution, then based on our former analysis, each vertex will take the same color with either the true node or the false node, and at least one of each clause will take the same color with the true node, so we can define a satisfying truth assignment based on the coloring. On the contrary, if the black box tells us that there is no solution, then the 3-SAT problem is unsatisfiable, because if it is, then we can also based on the satisfying truth assignment to give the graph a 3-coloring. 82 | 83 | Finally, we managed to use a 3-Color problem solver black box and polynomial steps to either solve the 3-SAT problem or prove there is no possible solution, and the black box uses $O(n)$ sized input graph, and only $O(1)$ other steps needed. Therefore, we proved that 3-SAT problem $\leq_p$ 3-Color problem. 84 | 85 | \newpage % reference page 86 | 87 | \renewcommand\refname{References} % change '&' in the link to '\&' 88 | \begin{thebibliography}{99} 89 | \bibitem[Jon Kleinberg / Éva Tardos(2005)]{textbook} Algorithm Design (Chapter 8) 90 | \end{thebibliography} 91 | 92 | \end{document} 93 | -------------------------------------------------------------------------------- /Assignment/Assignment5/report.toc: -------------------------------------------------------------------------------- 1 | \contentsline {section}{\numberline {1}Introduction}{3}{section.1}% 2 | \contentsline {subsection}{\numberline {1.1}3-SAT Problem}{3}{subsection.1.1}% 3 | \contentsline {subsection}{\numberline {1.2}3-Color Problem}{3}{subsection.1.2}% 4 | \contentsline {section}{\numberline {2}Proof}{3}{section.2}% 5 | -------------------------------------------------------------------------------- /Assignment/Assignments.txt: -------------------------------------------------------------------------------- 1 | Assignment 1 2 | 3 | In this assignment, you are required to apply the learned knowledge to analyze the extended Gale-Shapley algorithm used in Lab01B (see Lab01B-sol.pdf in the Resources for the algorithm outline). In particular, try to answer the following questions: 4 | 5 | 1. What is the time complexity? 6 | 7 | 2. How do we define stability for the college/student setting? Note that this setting allows one-to-many matching (e.g., one college can accept many students) and incomplete preference list (e.g., some colleges may be unacceptable by a student). Hint: Please refer to page 30 of Lecture01. 8 | 9 | 3. Prove that the extended GS algorithm indeed outputs a stable matching. 10 | 11 | 4. Does the student-proposing GS algorithm produce a student-optimal matching? 12 | 13 | Please submit your analysis here as a single PDF file. 14 | 15 | Assignment 2 16 | 17 | In this assignment, you need to understand and then describe a complicated algorithm. The goal of this assignment is to practice your writing/presentation skills. (This is crucial for your future success!) 18 | 19 | We learned in class that Chu-Liu's algorithm finds a min-cost arborescence in O(mn) time, but this is not very efficient. The attached lecture notes describe a more efficient algorithm/implementation that runs in O(m log n) time, which is much faster! 20 | 21 | Please read section 5 of the attached file and do the following: 22 | 23 | 1. Before writing, think how the lecture notes present the algorithm, e.g., why 5.1 is needed before 5.2 and 5.3. 24 | 25 | 2. Describe the algorithm implementation in your own words. Please do not copy-paste those from the lecture notes, because then you will learn nothing. Here the goal is to beat the lecture notes and explain the algorithm in a more clear way. 26 | 27 | 3. Please fill out the missing details about the underlying data structures, e.g., how to meld heaps? 28 | 29 | 4. Write your pseudocode or real program for the O(m log n) algorithm and then analyze its time complexity. Please be precise, e.g., specify the time complexity for each crucial step in your code. 30 | 31 | Note: The algorithm may involve several data structures and you can omit the description of those you already learned from your data structure course, e.g., union find set, binary heap, etc. However, more advanced data structures like leftist heaps have to be explained in sufficient details, i.e., imagine the readers only know the basic data structures and your goal is to let them understand. 32 | 33 | PS: Please feel free to describe an even faster algorithm instead, e.g., the O(m + n log n) algorithm proposed by Gabow, Galil, Spencer, and Tarjan in 1986. If you choose to do so, you don't need to describe the attached O(m log n) algorithm anymore, but please follow the same requirements as shown above. 34 | 35 | Please write in English and submit your writing as a single PDF file. Your writing will be graded based on quality, e.g., correctness, completeness, clarity, conciseness, etc. 36 | 37 | Note: There could be mistakes in the attached lecture notes, which could also appear in other online resources you may access when completing a task. You can treat this as part of your challenge. 38 | 39 | Attached file: 04-DMST.pdf 40 | 41 | Assignment 3 42 | 43 | We learned in class that fast Fourier transform (FFT) is designed to efficiently compute the discrete Fourier transform (and its inverse) of a sequence. FFT is a very popular algorithm with a lot of applications. 44 | 45 | In this assignment, you are asked to write a report to describe your favorite FFT applications. The goal of this assignment is to learn practical algorithms by yourself, systemize the learned knowledge, and explain it in a clear way. 46 | 47 | Your report will be graded based on quality, e.g., clarity, scope, succinctness, technicality, etc. We will also consider the importance of your selected FFT applications. Typically, we expect your report to have at least 5 applications and 2~3 of them should be described in sufficient technical details. Note that you could also introduce some variants of the FFT algorithm and discuss their applications. Please write your report in English. 48 | 49 | Hope you enjoy this assignment! 50 | 51 | Assignment 4 52 | 53 | In class we learned Bellman-Ford-Moore algorithm and its efficient implementation: the push-based implementation with O(n) extra space (also known as SPFA). We also learned how one can extend SPFA to detect negative cycles. However, in practice this implementation is still not fast enough. 54 | 55 | In this assignment, you are asked to understand and describe an efficient algorithm/implementation to find shortest paths and detect negative cycles. This algorithm combines Bellman-Ford-Moore with a so-called subtree disassembly trick proposed by Tarjan. Please read pages 304-307 in your textbook and do the following. 56 | 57 | 1. Write the pseudocode of this algorithm and explain its core idea and critical procedures in a clear way. 58 | 59 | 2. Analyze its running time and space complexity. 60 | 61 | 3. Explain in your words why in practice Tarjan's trick gains a considerable speedup compared to SPFA, even for graphs with no negative cycles. Note that the worst-case running time of this improved algorithm is nonetheless unchanged, i.e., O(mn). 62 | 63 | This should not be a complicated assignment. Please try to make sure your answers are clear and to the pint. Please write your answers in English and submit a single PDF file. 64 | 65 | Assignment 5 66 | 67 | In class we showed how to do polynomial-time reductions between problems, with simple examples. Actually, in your textbook, there are several more involved reduction examples. 68 | 69 | In this assignment, you are required to pick your favorite reduction from the following examples and write the proof in details. The proofs are explained in your textbook, but you must write the proof in your own words. Of course, you are encouraged to prove all of them (but one is enough for this assignment). The goal of this assignment is to understand how reduction works. Please describe the problem that you pick in sufficient details. 70 | 71 | 1. 3-SAT ≤ p Directed-Hamiltonian-Cycle 72 | 73 | 2. 3-SAT ≤ p 3D-Matching 74 | 75 | 3. 3-SAT ≤ p 3-Color 76 | 77 | 4. 3-SAT ≤ p Subset-Sum 78 | 79 | Note: It is not hard to show that all of the above problems are in NP. Later you will learn that 3-SAT is in NP-complete and hence those problems are actually in NP-complete. 80 | 81 | Please write in English and submit a single PDF file. -------------------------------------------------------------------------------- /Assignment/temp_report.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{ctex} 4 | \usepackage{graphicx} 5 | \usepackage{float} 6 | \usepackage{datetime} 7 | \usepackage{hyperref} 8 | \usepackage{amssymb} 9 | \usepackage{amsthm} 10 | \newtheorem{theorem}{Theorem} 11 | \newtheorem{corollary}{Colollary} 12 | \newtheorem{lemma}{Lemma} 13 | \newtheorem{definition}{Definition} 14 | \renewcommand\proofname{Proof} 15 | \renewcommand\figurename{Figure} 16 | \usepackage{listings} 17 | \usepackage{xcolor} 18 | \usepackage[linesnumbered, ruled]{algorithm2e} 19 | \usepackage[legalpaper, margin=1.4in]{geometry} 20 | 21 | \title{CS216 Assignment0 \\ {\begin{large} What is the title \end{large}}} %title 22 | 23 | \author{匡亮(12111012)} 24 | 25 | \date{April 21, 2023} % date 26 | 27 | \begin{document} 28 | 29 | \maketitle 30 | 31 | \renewcommand\abstractname{Abstract} 32 | \begin{abstract} 33 | 34 | This is my report of CS216 Assignment0, including: 35 | 36 | \begin{itemize} 37 | \item[1.] whatwhat 38 | \item[2.] 39 | \end{itemize} 40 | 41 | \end{abstract} 42 | 43 | \newpage % contents page 44 | 45 | \renewcommand\contentsname{Contents} 46 | \tableofcontents 47 | 48 | \newpage % 1st page here 49 | 50 | 51 | 52 | \newpage % reference page 53 | 54 | \renewcommand\refname{References} % change '&' in the link to '\&' 55 | \begin{thebibliography}{99} 56 | \bibitem[who(year)]{short} title 57 | 58 | http://linklink.xxx 59 | \end{thebibliography} 60 | 61 | \end{document} 62 | -------------------------------------------------------------------------------- /Lab/Lab1/Lab1-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab1/Lab1-A.pdf -------------------------------------------------------------------------------- /Lab/Lab1/Lab1-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab1/Lab1-B.pdf -------------------------------------------------------------------------------- /Lab/Lab1/a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | const int MaxN = 1000 + 10; 5 | int N; 6 | int Map[MaxN][MaxN], Point[MaxN][MaxN], Lastpro[MaxN], Ans1[MaxN]; 7 | int Map2[MaxN][MaxN], Point2[MaxN][MaxN], Nowpro[MaxN], Ans2[MaxN]; 8 | char Name[MaxN][13], Name2[MaxN][13], str[13]; 9 | queue Q; 10 | const int MaxM = 20000 + 10; 11 | int Id[MaxM], To[MaxM][52], Cnt; 12 | inline int toInt(char c) { 13 | if(c <= 'Z') return c - 'A'; 14 | return c - 'a' + 26; 15 | } 16 | void Insert(int id, char *strs, int len) { 17 | int Nod = 0; 18 | For(i, 0, len - 1) { 19 | int toint = toInt(strs[i]); 20 | if(To[Nod][toint] == 0) To[Nod][toint] = ++Cnt; 21 | Nod = To[Nod][toint]; 22 | } 23 | Id[Nod] = id; 24 | } 25 | int getId(char *strs, int len) { 26 | int Nod = 0; 27 | For(i, 0, len - 1) Nod = To[Nod][toInt(strs[i])]; 28 | return Id[Nod]; 29 | } 30 | int main() { 31 | scanf("%d", &N); 32 | For(i, 1, N) { 33 | scanf("%s", Name[i]); 34 | Insert(i, Name[i], strlen(Name[i])); 35 | } 36 | For(i, 1, N) { 37 | scanf("%s", Name2[i]); 38 | Insert(i, Name2[i], strlen(Name2[i])); 39 | } 40 | For(i, 1, N) 41 | Q.push(i); 42 | For(i, 1, N) 43 | For(j, 1, N) { 44 | memset(str, 0, sizeof str); 45 | scanf("%s", str); 46 | Map[i][j] = getId(str, strlen(str)); 47 | Point[i][Map[i][j]] = N - j; 48 | } 49 | For(i, 1, N) 50 | For(j, 1, N) { 51 | memset(str, 0, sizeof str); 52 | scanf("%s", str); 53 | Map2[i][j] = getId(str, strlen(str)); 54 | Point2[i][Map2[i][j]] = N - j; 55 | } 56 | while(!Q.empty()) { 57 | int Man = Q.front(); Q.pop(); 58 | int Woman = Map[Man][++Lastpro[Man]]; 59 | if(Nowpro[Woman] == 0) Nowpro[Woman] = Man; 60 | else if(Point2[Woman][Man] > Point2[Woman][Nowpro[Woman]]) { 61 | Q.push(Nowpro[Woman]); 62 | Nowpro[Woman] = Man; 63 | } else Q.push(Man); 64 | } 65 | For(i, 1, N) { 66 | Ans1[Nowpro[i]] = i; 67 | Ans2[i] = Nowpro[i]; 68 | } 69 | For(i, 1, N) 70 | For(j, 1, N) 71 | if(Point[i][j] > Point[i][Ans1[i]] && Point2[j][i] > Point2[j][Ans2[j]]) 72 | return !printf("Wrong Answer\n"); 73 | For(i, 1, N) { 74 | printf("%s %s", Name[i], Name2[Ans1[i]]); 75 | if(i != N) printf("\n"); 76 | } 77 | return 0; 78 | } 79 | /* 80 | 3 81 | aaa bbbb c 82 | a bb cc 83 | cc a bb 84 | a bb cc 85 | bb cc a 86 | aaa bbbb cc 87 | aaa bbbb cc 88 | aaa bbbb cc 89 | 90 | */ 91 | -------------------------------------------------------------------------------- /Lab/Lab1/b.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | const int MaxN = 1000 + 10; 5 | int N, M; 6 | int Cap[MaxN]; 7 | pair Point1[MaxN][MaxN]; 8 | int lastApply[MaxN]; 9 | int Point2[MaxN][MaxN]; 10 | queue Q; 11 | priority_queue> enrolled[MaxN]; 12 | 13 | bool Enroll[MaxN][MaxN]; 14 | int Point[MaxN][MaxN]; 15 | int enrollSchool[MaxN], worstStudent[MaxN], enrollNumber[MaxN]; 16 | 17 | inline void Check() { 18 | For(i, 1, N) 19 | For(j, 1, M) 20 | if(Enroll[i][j]) { 21 | if(Point[i][j] < 0) printf("Student %d would prefer not to enroll school %d.\n", i, j); 22 | if(Point2[j][i] < 0) printf("School %d would prefer not accept student %d.\n", j, i); 23 | } else { 24 | if(Point[i][enrollSchool[i]] < Point[i][j] && Point2[j][i] > 0 && (enrollNumber[j] < Cap[j] || worstStudent[j] < Point2[j][i])) printf("Student %d and school %d formed an unstable pair.\n", i, j); 25 | } 26 | } 27 | 28 | int main() { 29 | 30 | // freopen("b.in", "r", stdin); 31 | // freopen("b.out", "w", stdout); 32 | 33 | scanf("%d%d", &N, &M); 34 | For(i, 1, M) scanf("%d", &Cap[i]); 35 | For(i, 1, N) Q.push(i); 36 | For(i, 1, N) { 37 | For(j, 1, M) { 38 | scanf("%d", &Point1[i][j].first); 39 | Point[i][j] = Point1[i][j].first; 40 | Point1[i][j].second = j; 41 | } 42 | sort(Point1[i] + 1, Point1[i] + 1 + M); 43 | reverse(Point1[i] + 1, Point1[i] + 1 + M); 44 | } 45 | For(i, 1, M) 46 | For(j, 1, N) 47 | scanf("%d", &Point2[i][j]); 48 | while(!Q.empty()) { 49 | int Student = Q.front(); Q.pop(); 50 | if(lastApply[Student] == M) continue; 51 | int School = Point1[Student][++lastApply[Student]].second; 52 | if(Point1[Student][lastApply[Student]].first < 0 || Point2[School][Student] < 0) Q.push(Student); 53 | else if((int)enrolled[School].size() < Cap[School]) enrolled[School].push(make_pair(-Point2[School][Student], Student)); 54 | else if(-enrolled[School].top().first < Point2[School][Student]) { 55 | Q.push(enrolled[School].top().second); 56 | enrolled[School].pop(); 57 | enrolled[School].push(make_pair(-Point2[School][Student], Student)); 58 | } 59 | else Q.push(Student); 60 | } 61 | For(i, 1, M) { 62 | printf("%d ", (int)enrolled[i].size()); 63 | // enrollNumber[i] = (int)enrolled[i].size(); 64 | while(!enrolled[i].empty()) { 65 | printf("%d ", enrolled[i].top().second); 66 | // Enroll[enrolled[i].top().second][i] = true; 67 | // worstStudent[i] = min(worstStudent[i], -enrolled[i].top().first); 68 | // if(enrollSchool[enrolled[i].top().second]) printf("Student %d enrolled two schools %d and %d.\n", enrolled[i].top().second, i, enrollSchool[enrolled[i].top().second]); 69 | // enrollSchool[enrolled[i].top().second] = i; 70 | enrolled[i].pop(); 71 | } 72 | // if(i != M) printf("\n"); 73 | printf("\n"); 74 | } 75 | 76 | // Check(); 77 | 78 | return 0; 79 | } 80 | /* 81 | 1 1 82 | 1 83 | -1 84 | -1 85 | 86 | */ 87 | -------------------------------------------------------------------------------- /Lab/Lab10/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 1000000 + 10; 12 | const long long Inf = 1ll << 32; 13 | int N, M, S, T; 14 | int Cnt = 1, Head[MaxN], To[MaxN], Next[MaxN]; 15 | long long W[MaxN], Ans; 16 | inline void Add(int u, int v, long long w) { 17 | To[++Cnt] = v; 18 | W[Cnt] = w; 19 | Next[Cnt] = Head[u]; 20 | Head[u] = Cnt; 21 | } 22 | int Now[MaxN]; // Present-arc optimization 23 | int Dis[MaxN]; // Layer graph 24 | bool Bfs() { 25 | For(i, 1, N) Dis[i] = N, Now[i] = Head[i]; 26 | Dis[S] = 0; 27 | queue Q; Q.push(S); 28 | while(!Q.empty()) { 29 | int Nod = Q.front(); Q.pop(); 30 | for(int i = Head[Nod]; i ; i = Next[i]) 31 | if(W[i] > 0 && Dis[To[i]] == N) { 32 | Q.push(To[i]); 33 | Dis[To[i]] = Dis[Nod] + 1; 34 | } 35 | } 36 | return Dis[T] != N; 37 | } 38 | long long Dfs(int Nod, long long Limit) { 39 | if(Nod == T) return Limit; 40 | long long Tot = 0; 41 | for(int i = Now[Nod]; i && Limit ; i = Next[i]) { 42 | Now[Nod] = i; 43 | if(W[i] > 0 && Dis[To[i]] == Dis[Nod] + 1) { 44 | long long Flow = Dfs(To[i], min(Limit, W[i])); 45 | if(Flow == 0) Dis[To[i]] = N; 46 | else { 47 | W[i] -= Flow; 48 | W[i^1] += Flow; 49 | Tot += Flow; 50 | Limit -= Flow; 51 | } 52 | } 53 | } 54 | return Tot; 55 | } 56 | int main() { 57 | ios_base::sync_with_stdio(false); 58 | cin.tie(0); 59 | cout.tie(0); 60 | cin >> N >> M >> S >> T; 61 | For(i, 1, M) { 62 | int u, v; 63 | long long w; 64 | cin >> u >> v >> w; 65 | Add(u, v, w); 66 | Add(v, u, 0); 67 | } 68 | while(Bfs()) Ans += Dfs(S, Inf); 69 | cout << Ans << endl; 70 | return 0; 71 | } -------------------------------------------------------------------------------- /Lab/Lab10/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 1000000 + 10; 12 | const long long Inf = 1ll << 32; 13 | int N, M, S, T; 14 | int Cnt = 1, Head[MaxN], To[MaxN], Next[MaxN]; 15 | long long W[MaxN], Ans; 16 | inline void Add(int u, int v, long long w) { 17 | To[++Cnt] = v; 18 | W[Cnt] = w; 19 | Next[Cnt] = Head[u]; 20 | Head[u] = Cnt; 21 | } 22 | int Now[MaxN]; // Present-arc optimization 23 | int Dis[MaxN]; // Layer graph 24 | bool Bfs() { 25 | For(i, 1, N) Dis[i] = N, Now[i] = Head[i]; 26 | Dis[S] = 0; 27 | queue Q; Q.push(S); 28 | while(!Q.empty()) { 29 | int Nod = Q.front(); Q.pop(); 30 | for(int i = Head[Nod]; i ; i = Next[i]) 31 | if(W[i] > 0 && Dis[To[i]] == N) { 32 | Q.push(To[i]); 33 | Dis[To[i]] = Dis[Nod] + 1; 34 | } 35 | } 36 | return Dis[T] != N; 37 | } 38 | long long Dfs(int Nod, long long Limit) { 39 | if(Nod == T) return Limit; 40 | long long Tot = 0; 41 | for(int i = Now[Nod]; i && Limit ; i = Next[i]) { 42 | Now[Nod] = i; 43 | if(W[i] > 0 && Dis[To[i]] == Dis[Nod] + 1) { 44 | long long Flow = Dfs(To[i], min(Limit, W[i])); 45 | if(Flow == 0) Dis[To[i]] = N; 46 | else { 47 | W[i] -= Flow; 48 | W[i^1] += Flow; 49 | Tot += Flow; 50 | Limit -= Flow; 51 | } 52 | } 53 | } 54 | return Tot; 55 | } 56 | int K; 57 | int main() { 58 | ios_base::sync_with_stdio(false); 59 | cin.tie(0); 60 | cout.tie(0); 61 | cin >> N >> M >> K; 62 | S = 1; T = ++N; 63 | For(i, 1, K) { 64 | int g; cin >> g; ++g; 65 | Add(g, T, 1); Add(T, g, 0); 66 | } 67 | For(i, 1, M) { 68 | int u, v; cin >> u >> v; ++u; ++v; 69 | Add(u, v, 1); Add(v, u, 1); 70 | } 71 | while(Bfs()) Ans += Dfs(S, Inf); 72 | cout << Ans << endl; 73 | return 0; 74 | } -------------------------------------------------------------------------------- /Lab/Lab10/C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 1000000 + 10; 12 | const long long Inf = 1ll << 32; 13 | int N, M, S, T; 14 | int Cnt = 1, Head[MaxN], To[MaxN], Next[MaxN]; 15 | long long W[MaxN], Ans; 16 | inline void _Add(int u, int v, long long w) { 17 | To[++Cnt] = v; 18 | W[Cnt] = w; 19 | Next[Cnt] = Head[u]; 20 | Head[u] = Cnt; 21 | } 22 | inline void Add(int u, int v, long long w) { 23 | _Add(u, v, w); 24 | _Add(v, u, 0); 25 | } 26 | int Now[MaxN]; // Present-arc optimization 27 | int Dis[MaxN]; // Layer graph 28 | bool Bfs() { 29 | For(i, 1, N) Dis[i] = N, Now[i] = Head[i]; 30 | Dis[S] = 0; 31 | queue Q; Q.push(S); 32 | while(!Q.empty()) { 33 | int Nod = Q.front(); Q.pop(); 34 | for(int i = Head[Nod]; i ; i = Next[i]) 35 | if(W[i] > 0 && Dis[To[i]] == N) { 36 | Q.push(To[i]); 37 | Dis[To[i]] = Dis[Nod] + 1; 38 | } 39 | } 40 | return Dis[T] != N; 41 | } 42 | long long Dfs(int Nod, long long Limit) { 43 | if(Nod == T) return Limit; 44 | long long Tot = 0; 45 | for(int i = Now[Nod]; i && Limit ; i = Next[i]) { 46 | Now[Nod] = i; 47 | if(W[i] > 0 && Dis[To[i]] == Dis[Nod] + 1) { 48 | long long Flow = Dfs(To[i], min(Limit, W[i])); 49 | if(Flow == 0) Dis[To[i]] = N; 50 | else { 51 | W[i] -= Flow; 52 | W[i^1] += Flow; 53 | Tot += Flow; 54 | Limit -= Flow; 55 | } 56 | } 57 | } 58 | return Tot; 59 | } 60 | int Map[1005][1005]; 61 | long long Val[1005][1005]; 62 | int main() { 63 | ios_base::sync_with_stdio(false); 64 | cin.tie(0); 65 | cout.tie(0); 66 | cin >> N >> M; 67 | int cnt = 0; 68 | long long Sum = 0; 69 | For(i, 1, N) 70 | For(j, 1, M) { 71 | cin >> Val[i][j]; 72 | Sum += Val[i][j]; 73 | Map[i][j] = ++cnt; 74 | } 75 | S = N * M + 1; 76 | T = S + 1; 77 | For(i, 1, N) 78 | For(j, 1, M) 79 | if((i ^ j) & 1) { 80 | Add(S, Map[i][j], Val[i][j]); 81 | if(i != 1) Add(Map[i][j], Map[i-1][j], Inf); 82 | if(i != N) Add(Map[i][j], Map[i+1][j], Inf); 83 | if(j != 1) Add(Map[i][j], Map[i][j-1], Inf); 84 | if(j != M) Add(Map[i][j], Map[i][j+1], Inf); 85 | } else 86 | Add(Map[i][j], T, Val[i][j]); 87 | N = T; 88 | while(Bfs()) Ans += Dfs(S, Inf); 89 | cout << Sum - Ans << endl; 90 | return 0; 91 | } -------------------------------------------------------------------------------- /Lab/Lab10/D.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 1000000 + 10; 12 | const long long Inf = 1ll << 32; 13 | int N, M, S, T; 14 | int Cnt = 1, Head[MaxN], To[MaxN], Next[MaxN]; 15 | long long W[MaxN], Ans; 16 | inline void _Add(int u, int v, long long w) { 17 | To[++Cnt] = v; 18 | W[Cnt] = w; 19 | Next[Cnt] = Head[u]; 20 | Head[u] = Cnt; 21 | } 22 | inline void Add(int u, int v, long long w) { 23 | _Add(u, v, w); 24 | _Add(v, u, 0); 25 | } 26 | int Now[MaxN]; // Present-arc optimization 27 | int Dis[MaxN]; // Layer graph 28 | bool Bfs() { 29 | For(i, 1, N) Dis[i] = N, Now[i] = Head[i]; 30 | Dis[S] = 0; 31 | queue Q; Q.push(S); 32 | while(!Q.empty()) { 33 | int Nod = Q.front(); Q.pop(); 34 | for(int i = Head[Nod]; i ; i = Next[i]) 35 | if(W[i] > 0 && Dis[To[i]] == N) { 36 | Q.push(To[i]); 37 | Dis[To[i]] = Dis[Nod] + 1; 38 | } 39 | } 40 | return Dis[T] != N; 41 | } 42 | long long Dfs(int Nod, long long Limit) { 43 | if(Nod == T) return Limit; 44 | long long Tot = 0; 45 | for(int i = Now[Nod]; i && Limit ; i = Next[i]) { 46 | Now[Nod] = i; 47 | if(W[i] > 0 && Dis[To[i]] == Dis[Nod] + 1) { 48 | long long Flow = Dfs(To[i], min(Limit, W[i])); 49 | if(Flow == 0) Dis[To[i]] = N; 50 | else { 51 | W[i] -= Flow; 52 | W[i^1] += Flow; 53 | Tot += Flow; 54 | Limit -= Flow; 55 | } 56 | } 57 | } 58 | return Tot; 59 | } 60 | int n, x[MaxN], a[MaxN], dp[MaxN]; 61 | int main() { 62 | ios_base::sync_with_stdio(false); 63 | cin.tie(0); 64 | cout.tie(0); 65 | cin >> n; 66 | For(i, 1, n) cin >> a[i]; 67 | For(i, 1, n) cin >> x[i]; 68 | // DP part 69 | For(i, 1, n) 70 | For(j, 0, i - 1) 71 | if(a[j] <= a[i]) 72 | Checkmax(dp[i], dp[j] + 1); 73 | int k = 0; 74 | For(i, 1, n) 75 | Checkmax(k, dp[i]); 76 | cout << k << endl; 77 | // Flow part 78 | N = (n + 1) << 1; 79 | S = N - 1; 80 | T = N; 81 | For(i, 1, n) Add((i << 1) - 1, i << 1, x[i]); 82 | For(i, 1, n) { 83 | if(dp[i] == 1) Add(S, (i << 1) - 1, Inf); 84 | if(dp[i] == k) Add(i << 1, T, Inf); 85 | For(j, i + 1, n) 86 | if(a[i] <= a[j] && dp[i] + 1 == dp[j]) 87 | Add(i << 1, (j << 1) - 1, Inf); 88 | } 89 | while(Bfs()) Ans += Dfs(S, Inf); 90 | cout << Ans << endl; 91 | return 0; 92 | } -------------------------------------------------------------------------------- /Lab/Lab10/Lab10-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab10/Lab10-A.pdf -------------------------------------------------------------------------------- /Lab/Lab10/Lab10-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab10/Lab10-B.pdf -------------------------------------------------------------------------------- /Lab/Lab10/Lab10-C.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab10/Lab10-C.pdf -------------------------------------------------------------------------------- /Lab/Lab10/Lab10-D.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab10/Lab10-D.pdf -------------------------------------------------------------------------------- /Lab/Lab2/Lab2-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab2/Lab2-A.pdf -------------------------------------------------------------------------------- /Lab/Lab2/Lab2-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab2/Lab2-B.pdf -------------------------------------------------------------------------------- /Lab/Lab2/a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | int main() { 5 | int t; 6 | cin >> t; 7 | while(t--) { 8 | int n; 9 | cin >> n; 10 | if(n % 6) printf("Alice\n"); 11 | else printf("Bob\n"); 12 | } 13 | return 0; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Lab/Lab2/b.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | int main() { 5 | int N, K; 6 | cin >> N >> K; 7 | if (K > N / 2) K = N - K + 1; 8 | printf("%d\n", N == 1 ? 1 : 2 * K); 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Lab/Lab3/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | const int MaxN = 1000 + 10; 5 | int N, Sum, T[MaxN], W[MaxN]; 6 | vector Time[MaxN]; 7 | priority_queue Q; 8 | int main() { 9 | ios_base::sync_with_stdio(false); 10 | cin.tie(0); cout.tie(0); 11 | cin >> N; 12 | For(i, 1, N) cin >> T[i]; 13 | For(i, 1, N) cin >> W[i]; 14 | For(i, 1, N) Time[T[i]].push_back(W[i]); 15 | For(i, 1, N) { 16 | int sz = (int)Time[i].size(); 17 | For(j, 1, sz) { 18 | int Game = Time[i][j - 1]; 19 | Q.push(-Game); 20 | if((int)Q.size() > i) { 21 | Sum -= Q.top(); 22 | Q.pop(); 23 | } 24 | } 25 | } 26 | cout << Sum << endl; 27 | return 0; 28 | // Time Complexity: O(NlogN) 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Lab/Lab3/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | const int MaxN = 1000000 + 10; 5 | int N; 6 | long long A[MaxN], C[MaxN], Avg, Mid, Ans; 7 | int main() { 8 | ios_base::sync_with_stdio(false); 9 | cin.tie(0); cout.tie(0); 10 | cin >> N; 11 | For(i, 1, N) { 12 | cin >> A[i]; 13 | Avg += A[i]; 14 | } 15 | Avg /= N; 16 | For(i, 1, N - 1) C[i] = C[i - 1] + A[i] - Avg; 17 | nth_element(C + 1, C + (N + 1) / 2, C + N + 1); 18 | Mid = C[(N + 1) / 2]; 19 | For(i, 1, N) Ans += abs(C[i] - Mid); 20 | cout << Ans << endl; 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /Lab/Lab3/Lab3-A.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab3/Lab3-A.png -------------------------------------------------------------------------------- /Lab/Lab3/Lab3-B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab3/Lab3-B.png -------------------------------------------------------------------------------- /Lab/Lab4/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | #define SQU(x) ((x)*(x)) 4 | using namespace std; 5 | const int MaxN = 1000 + 10; 6 | int N, K, M; 7 | long long X[MaxN], Y[MaxN]; 8 | int Find[MaxN]; 9 | int F(int N) { 10 | return N == Find[N] ? N : Find[N] = F(Find[N]); 11 | } 12 | vector>> Edge; 13 | int main() { 14 | ios_base::sync_with_stdio(false); 15 | cin.tie(0); cout.tie(0); 16 | cin >> N >> K; 17 | For(i, 1, N) cin >> X[i] >> Y[i]; 18 | M = N; 19 | For(i, 1, N) Find[i] = i; 20 | For(i, 1, N) For(j, i + 1, N) 21 | Edge.push_back(make_pair(SQU(X[i] - X[j]) + SQU(Y[i] - Y[j]), make_pair(i, j))); 22 | sort(Edge.begin(), Edge.end()); 23 | for(auto e : Edge) { 24 | long long w = e.first; 25 | int u = e.second.first, v = e.second.second; 26 | if(F(u) == F(v)) continue; 27 | if(M == K) return not printf("%.2lf\n", sqrt(w)); 28 | --M; 29 | Find[Find[u]] = Find[v]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Lab/Lab4/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | const int MaxN = 100000 + 10; 5 | int N, Fa[MaxN], R, Find[MaxN]; 6 | vector To[MaxN]; 7 | long long Cost[MaxN], Sum[MaxN], C[MaxN], Siz[MaxN]; 8 | int F(int N) { 9 | return N == Find[N] ? N : Find[N] = F(Find[N]); 10 | } 11 | priority_queue> Q; 12 | bool Vis[MaxN]; 13 | int main() { 14 | ios_base::sync_with_stdio(false); 15 | cin.tie(0); cout.tie(0); 16 | cin >> N >> R; 17 | For(i, 1, N) cin >> C[i]; 18 | For(i, 1, N - 1) { 19 | int U, V; 20 | cin >> U >> V; 21 | To[U].push_back(V); 22 | Fa[V] = U; 23 | } 24 | For(i, 1, N) { 25 | Q.push(make_pair((double)C[i], i)); 26 | Siz[i] = 1; 27 | Sum[i] = Cost[i] = C[i]; 28 | Find[i] = i; 29 | } 30 | Vis[R] = true; 31 | while(!Q.empty()) { 32 | int Nod = Q.top().second; Q.pop(); 33 | if(Vis[Nod]) continue; 34 | Vis[Nod] = true; 35 | int fa = F(Fa[Nod]); 36 | Find[Nod] = fa; 37 | Cost[fa] += Cost[Nod] + Siz[fa] * Sum[Nod]; 38 | Siz[fa] += Siz[Nod]; 39 | Sum[fa] += Sum[Nod]; 40 | Q.push(make_pair((double)Sum[fa] / Siz[fa], fa)); 41 | } 42 | cout << Cost[R] << endl; 43 | return 0; 44 | } 45 | /* 46 | 5 1 47 | 1 2 1 2 4 48 | 1 2 49 | 1 3 50 | 2 4 51 | 3 5 52 | 53 | 5 1 54 | 1 1 1 2 1 55 | 1 2 56 | 2 3 57 | 3 5 58 | 1 4 59 | 60 | */ 61 | -------------------------------------------------------------------------------- /Lab/Lab4/Lab4-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab4/Lab4-A.pdf -------------------------------------------------------------------------------- /Lab/Lab4/Lab4-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab4/Lab4-B.pdf -------------------------------------------------------------------------------- /Lab/Lab5/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define For(_, L, R) for(int _ = L; _ <= R; ++_) 3 | using namespace std; 4 | const int Ans[5][5] = { 5 | {1, 1, 1, 1, 1}, 6 | {0, 1, 1, 1, 1}, 7 | {0, 0, 2, 1, 1}, 8 | {0, 0, 0, 0, 1}, 9 | {0, 0, 0, 0, 0}}, 10 | dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}, 11 | dy[8] = {1, -1, 2, -2, 2, -2, 1, -1}; 12 | int Map[5][5], x, y; 13 | int v() { 14 | int V = 0; 15 | For(i, 0, 4) 16 | For(j, 0, 4) 17 | V += (Map[i][j] != Ans[i][j]); 18 | return V == 2 ? 1 : V; 19 | } 20 | bool IDAx(int dep, int lim) { 21 | if(dep == lim) return !(bool)v(); 22 | For(i, 0, 7) { 23 | int xx = x, yy = y; 24 | x += dx[i], y += dy[i]; 25 | if(x >= 0 && y >= 0 && x <= 4 && y <= 4) { 26 | swap(Map[x][y], Map[xx][yy]); 27 | if(v() + dep <= lim) 28 | if(IDAx(dep + 1, lim)) 29 | return true; 30 | swap(Map[x][y], Map[xx][yy]); 31 | } 32 | x = xx, y = yy; 33 | } 34 | return false; 35 | } 36 | int main() { 37 | int T; cin >> T; while(T--) { 38 | For(i, 0, 4) 39 | For(j, 0, 4) { 40 | char C = getchar(); 41 | while(C != '0' && C != '1' && C != '*') C = getchar(); 42 | if((Map[i][j] = (C == '1' ? 1 : (C == '0' ? 0 : 2))) == 2) x = i, y = j; 43 | } 44 | bool notfound = true; 45 | For(i, 0, 15) 46 | if(IDAx(0, i)) { 47 | cout << i << endl; 48 | notfound = false; 49 | break; 50 | } 51 | if(notfound) cout << -1 << endl; 52 | } 53 | return 0; 54 | } 55 | /* 56 | 1 57 | 11111 58 | 01111 59 | 00111 60 | 0000* 61 | 00000 62 | 63 | */ 64 | -------------------------------------------------------------------------------- /Lab/Lab5/Lab5-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab5/Lab5-A.pdf -------------------------------------------------------------------------------- /Lab/Lab5/Lab5-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab5/Lab5-B.pdf -------------------------------------------------------------------------------- /Lab/Lab6/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 1000000 + 10; 12 | int N, M, T, C; 13 | int Del[MaxN], Time[MaxN], Val[MaxN]; 14 | priority_queue Q, D; 15 | int Top() { 16 | while(!Q.empty() && !D.empty() && Q.top() == D.top()) 17 | Q.pop(), D.pop(); 18 | return Q.empty() ? 0 : Q.top(); 19 | } 20 | int main() { 21 | ios_base::sync_with_stdio(false); 22 | cin.tie(0); 23 | cout.tie(0); 24 | cin >> N >> M >> T; 25 | For(i, 1, M) { 26 | if(Del[i]) { 27 | D.push(-i); 28 | Val[Del[i]] = 0; 29 | Time[Del[i]] = 0; 30 | Del[i] = 0; 31 | --C; 32 | } 33 | int op, k, v; 34 | cin >> op; 35 | if(op == 1) { 36 | cin >> k; 37 | if(Val[k]) { 38 | printf("%d\n", Val[k]); 39 | Del[Time[k]] = 0; 40 | D.push(-Time[k]); 41 | Del[Time[k] = i + T + 1] = k; 42 | Q.push(-Time[k]); 43 | } else printf("-1\n"); 44 | } else { 45 | cin >> k >> v; 46 | if(Val[k]) { 47 | Val[k] = v; 48 | Del[Time[k]] = 0; 49 | D.push(-Time[k]); 50 | Del[Time[k] = i + T + 1] = k; 51 | Q.push(-Time[k]); 52 | } else { 53 | if(C == N) { 54 | int t = Del[-Top()]; 55 | Q.pop(); 56 | Del[Time[t]] = 0; 57 | Time[t] = 0; 58 | Val[t] = 0; 59 | } else ++C; 60 | Del[Time[k] = i + T + 1] = k; 61 | Val[k] = v; 62 | Q.push(-Time[k]); 63 | } 64 | } 65 | } 66 | int t; 67 | while(t = -Top()) 68 | printf("%d ", Val[Del[t]]), Q.pop(); 69 | printf("\n"); 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /Lab/Lab6/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | struct Point { long long X, Y; }; 12 | bool Cmp(Point &A, Point &B) { return A.X == B.X ? A.Y < B.Y : A.X < B.X; } 13 | const int MaxN = 3000000 + 10; 14 | long long Mindist = (long long)9e16; 15 | double mindist = 3e8; 16 | int N, Q[MaxN]; 17 | Point P[MaxN], Reg[MaxN]; 18 | inline long long Squ(long long X) { return X * X; } 19 | inline void Update(int i, int j) { 20 | long long Newdist = Squ(P[i].X - P[j].X) + Squ(P[i].Y - P[j].Y); 21 | if(Mindist > Newdist) mindist = sqrt(Mindist = Newdist); 22 | } 23 | void Merge(int L, int Mid, int R) { 24 | int l = L, r = Mid + 1, reg = L; 25 | while(l <= Mid && r <= R) 26 | if(P[l].Y < P[r].Y) Reg[reg++] = P[l++]; 27 | else Reg[reg++] = P[r++]; 28 | while(l <= Mid) Reg[reg++] = P[l++]; 29 | while(r <= R) Reg[reg++] = P[r++]; 30 | For(i, L, R) P[i] = Reg[i]; 31 | } 32 | void Solve(int L, int R) { 33 | if(L == R) return; 34 | int Mid = (L + R) >> 1, Midx = P[Mid].X, Qtop = 0; 35 | Solve(L, Mid); Solve(Mid + 1, R); Merge(L, Mid, R); 36 | For(i, L, R) 37 | if(Midx - mindist < P[i].X && P[i].X < Midx + mindist) { 38 | for(int j = Qtop; j && P[i].Y - P[Q[j]].Y < mindist; --j) Update(i, Q[j]); 39 | Q[++Qtop] = i; 40 | } 41 | } 42 | int main() { 43 | ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 44 | cin >> N; For(i, 1, N) cin >> P[i].X >> P[i].Y; 45 | sort(P + 1, P + 1 + N, Cmp); 46 | Solve(1, N); 47 | printf("%lld\n", Mindist); 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /Lab/Lab6/Lab6-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab6/Lab6-A.pdf -------------------------------------------------------------------------------- /Lab/Lab6/Lab6-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab6/Lab6-B.pdf -------------------------------------------------------------------------------- /Lab/Lab7/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 2100000 + 10; 12 | struct cp { 13 | double x, y; 14 | cp (double X = 0, double Y = 0) { x = X, y = Y; } 15 | }; 16 | cp operator + (cp a,cp b) { return cp(a.x + b.x, a.y + b.y); } 17 | cp operator - (cp a,cp b) { return cp(a.x - b.x, a.y - b.y); } 18 | cp operator * (cp a,cp b) { return cp(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x); } 19 | cp A[MaxN], B[MaxN], C[MaxN]; 20 | const double pi = acos(-1.0); 21 | int N, M, Lim = 1, L; 22 | int R[MaxN]; 23 | void FFT(cp *A, int type) { 24 | For(i, 0, Lim - 1) 25 | if(i < R[i]) swap(A[i], A[R[i]]); 26 | for(int i = 1; i < Lim; i <<= 1) { 27 | cp wn = cp(cos(pi / i), type * sin(pi / i)); 28 | for(int R = i << 1, j = 0; j < Lim; j += R) { 29 | cp w = cp(1, 0); 30 | for(int k = 0; k < i; ++k, w = w * wn) { 31 | cp x = A[j + k], y = w * A[j + k + i]; 32 | A[j + k] = x + y; 33 | A[j + k + i] = x - y; 34 | } 35 | } 36 | } 37 | } 38 | int main() { 39 | ios_base::sync_with_stdio(false); 40 | cin.tie(0); 41 | cout.tie(0); 42 | cin >> N; 43 | For(i, 1, N) { 44 | cin >> A[i].x; 45 | B[i].x = 1.0 / i / i; 46 | C[N - i].x = A[i].x; 47 | } 48 | while(Lim <= (N << 1)) Lim <<= 1, ++L; 49 | For(i, 0, Lim - 1) R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1)); 50 | FFT(A, 1); FFT(B, 1); FFT(C, 1); 51 | For(i, 0, Lim - 1) A[i] = A[i] * B[i], C[i] = C[i] * B[i]; 52 | FFT(A, -1); FFT(C, -1); 53 | For(i, 1, N) printf("%.5lf\n", (A[i].x - C[N - i].x) / Lim); 54 | return 0; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /Lab/Lab7/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 1100000 + 10; 12 | const int Mod = 998244353; 13 | inline int Pow(int A, int B) { 14 | int Ans = 1; 15 | while(B) { 16 | if(B & 1) Ans = 1ll * Ans * A % Mod; 17 | A = 1ll * A * A % Mod; 18 | B >>= 1; 19 | } 20 | return Ans; 21 | } 22 | const int G = 3; 23 | const int iG = Pow(G, Mod - 2); 24 | int N, M, Lim = 1, L, R[MaxN]; 25 | void NTT(int *A, int type) { 26 | For(i, 0, Lim - 1) 27 | if(i < R[i]) swap(A[i], A[R[i]]); 28 | for(int i = 1; i < Lim; i <<= 1) { 29 | int wn = Pow(type == 1 ? G : iG, (Mod - 1) / (i << 1)); 30 | for(int R = i << 1, j = 0; j < Lim; j += R) { 31 | int w = 1; 32 | for(int k = 0; k < i; ++k, w = 1ll * w * wn % Mod) { 33 | int x = A[j + k], y = 1ll * w * A[j + k + i] % Mod; 34 | A[j + k] = (x + y) % Mod; 35 | A[j + k + i] = (x - y + Mod) % Mod; 36 | } 37 | } 38 | } 39 | if(type == -1) { 40 | int inv = Pow(Lim, Mod - 2); 41 | For(i, 0, Lim - 1) 42 | A[i] = 1ll * A[i] * inv % Mod; 43 | } 44 | } 45 | int A[MaxN], B[MaxN], A2[MaxN], B2[MaxN], A3[MaxN], B3[MaxN], C[MaxN]; 46 | char S[MaxN]; 47 | int Charmap[300]; 48 | int main() { 49 | Charmap['?'] = 0, Charmap['0'] = 1, Charmap['1'] = 2; 50 | cin >> S; 51 | N = strlen(S); 52 | For(i, 0, N - 1) { 53 | A[i] = Charmap[S[i]]; 54 | A2[i] = A[i] * A[i]; 55 | A3[i] = A2[i] * A[i]; 56 | B[i] = Charmap[S[N - 1 - i]]; 57 | B2[i] = B[i] * B[i]; 58 | B3[i] = B2[i] * B[i]; 59 | } 60 | while(Lim <= N + N + 2) Lim <<= 1, ++L; 61 | For(i, 0, Lim - 1) R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1)); 62 | NTT(A, 1); NTT(B, 1); NTT(A2, 1); NTT(B2, 1); NTT(A3, 1); NTT(B3, 1); 63 | For(i, 0, Lim - 1) 64 | C[i] = ((1ll * A[i] * B3[i] + 1ll * B[i] * A3[i] - 2ll * A2[i] * B2[i]) % Mod + Mod) % Mod; 65 | NTT(C, -1); 66 | long long Ans = 0; 67 | For(i, 1, N / 2) 68 | if(C[i - 1] == 0) 69 | Ans ^= 1ll * i * i; 70 | printf("%lld\n", Ans); 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /Lab/Lab7/Lab7-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab7/Lab7-A.pdf -------------------------------------------------------------------------------- /Lab/Lab7/Lab7-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab7/Lab7-B.pdf -------------------------------------------------------------------------------- /Lab/Lab8/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 100 + 10; 12 | const int MaxM = 40000 + 10; 13 | int N, C, V[MaxN], W[MaxN], S[MaxN]; 14 | struct Queue { 15 | int Lim, Bias, T[MaxM], W[MaxM], Head, Tail; 16 | void Push(int t, int w) { 17 | w -= Bias; 18 | while(Head < Tail && W[Tail] <= w) --Tail; 19 | W[++Tail] = w; 20 | T[Tail] = t; 21 | } 22 | void Init(int lim, int w) { 23 | Bias = Head = T[1] = 0; 24 | Tail = 1; 25 | W[1] = w; 26 | Lim = lim; 27 | } 28 | int Pop(int t) { 29 | while(Head < Tail && T[Head + 1] + Lim < t) ++Head; 30 | return Head == Tail ? -(1 << 30) : W[Head + 1] + Bias; 31 | } 32 | } q[MaxN]; 33 | int Dp[MaxM], Reg[MaxM]; 34 | int main() { 35 | ios_base::sync_with_stdio(false); 36 | cin.tie(0); 37 | cout.tie(0); 38 | cin >> N >> C; 39 | For(i, 1, N) cin >> W[i] >> V[i] >> S[i]; 40 | For(i, 1, N) { 41 | For(j, 0, C) 42 | if(j < V[i]) q[j].Init(S[i], Reg[j] = Dp[j]); 43 | else { 44 | int id = j % V[i], t = j / V[i]; 45 | q[id].Bias += W[i]; 46 | Reg[j] = max(Dp[j], q[id].Pop(t)); 47 | q[id].Push(t, Dp[j]); 48 | } 49 | memcpy(Dp, Reg, sizeof Dp); 50 | } 51 | int Ans = 0; 52 | For(i, 0, C) 53 | Checkmax(Ans, Dp[i]); 54 | cout << Ans << endl; 55 | return 0; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /Lab/Lab8/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int Mod = 12345678; 12 | inline void Qmod(int &A) { 13 | if(A >= Mod) A -= Mod; 14 | } 15 | int N, M, K; 16 | int Dp[155][155][25][25]; 17 | int main() { 18 | ios_base::sync_with_stdio(false); 19 | cin.tie(0); 20 | cout.tie(0); 21 | cin >> N >> M >> K; 22 | Dp[0][0][0][0] = 1; 23 | For(i, 0, N) For(j, 0, M) For(m, 0, K) For(n, 0, K) 24 | Qmod(Dp[i + 1][j][m + 1][max(0, n - 1)] += Dp[i][j][m][n]), 25 | Qmod(Dp[i][j + 1][max(0, m - 1)][n + 1] += Dp[i][j][m][n]); 26 | int Ans = 0; 27 | For(i, 0, K) For(j, 0, K) 28 | Qmod(Ans += Dp[N][M][i][j]); 29 | cout << Ans << endl; 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Lab/Lab8/Lab8-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab8/Lab8-A.pdf -------------------------------------------------------------------------------- /Lab/Lab8/Lab8-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab8/Lab8-B.pdf -------------------------------------------------------------------------------- /Lab/Lab9/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 200000 + 10; 12 | int N; 13 | int Head[MaxN], To[MaxN], Next[MaxN], Cnt; 14 | inline void Add(int U, int V) { 15 | To[++Cnt] = V; 16 | Next[Cnt] = Head[U]; 17 | Head[U] = Cnt; 18 | } 19 | long long V[MaxN], Plus[MaxN], Minus[MaxN]; 20 | void Dfs(int Nod, int Fa) { 21 | for(int i = Head[Nod]; i ; i = Next[i]) 22 | if(To[i] != Fa) { 23 | Dfs(To[i], Nod); 24 | Checkmax(Plus[Nod], Plus[To[i]]); 25 | Checkmax(Minus[Nod], Minus[To[i]]); 26 | } 27 | long long Now = V[Nod] + Plus[Nod] - Minus[Nod]; 28 | if(Now < 0) Plus[Nod] -= Now; 29 | else Minus[Nod] += Now; 30 | } 31 | int main() { 32 | ios_base::sync_with_stdio(false); 33 | cin.tie(0); 34 | cout.tie(0); 35 | cin >> N; 36 | For(i, 1, N - 1) { 37 | int U, V; 38 | cin >> U >> V; 39 | Add(U, V); 40 | Add(V, U); 41 | } 42 | For(i, 1, N) cin >> V[i]; 43 | Dfs(1, 0); 44 | cout << Plus[1] + Minus[1] << endl; 45 | return 0; 46 | } -------------------------------------------------------------------------------- /Lab/Lab9/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 27000 + 10; 12 | int N, M; 13 | int Head[MaxN], To[MaxN], Next[MaxN], V[MaxN], P[MaxN], Cnt; 14 | double W[MaxN], Dis[MaxN]; 15 | inline void Add(int S, int T) { 16 | To[++Cnt] = T; 17 | Next[Cnt] = Head[S]; 18 | Head[S] = Cnt; 19 | } 20 | bool Vis[MaxN]; 21 | bool Spfa(int Nod) { 22 | Vis[Nod] = true; 23 | for(int i = Head[Nod]; i ; i = Next[i]) { 24 | if(Dis[To[i]] > Dis[Nod] + W[i]) { 25 | if(Vis[To[i]]) return false; 26 | else { 27 | Dis[To[i]] = Dis[Nod] + W[i]; 28 | if(!Spfa(To[i])) return false; 29 | } 30 | } 31 | } 32 | Vis[Nod] = false; 33 | return true; 34 | } 35 | int main() { 36 | ios_base::sync_with_stdio(false); 37 | cin.tie(0); 38 | cout.tie(0); 39 | cin >> N >> M; 40 | For(i, 1, M) { 41 | int S, T; 42 | cin >> S >> T >> V[i]; 43 | Add(S, T); 44 | } 45 | For(i, 1, M) cin >> P[i]; 46 | For(i, 1, N) Add(0, i); 47 | double L = 0.0, R = 256.0, Mid; 48 | For(_, 1, 15) { 49 | Mid = (L + R) / 2; 50 | For(i, 1, M) W[i] = Mid * P[i] - V[i]; 51 | memset(Dis, 127, sizeof Dis); 52 | memset(Vis, 0, sizeof Vis); 53 | Dis[0] = 0.0; 54 | if(Spfa(0)) R = Mid; 55 | else L = Mid; 56 | } 57 | if(fabs(L) < 1e-3) printf("-1\n"); 58 | else printf("%.1f\n", L); 59 | return 0; 60 | } -------------------------------------------------------------------------------- /Lab/Lab9/C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | int N, Mod; 12 | inline void Qmod(int &Ans) { 13 | if(Ans >= Mod) Ans -= Mod; 14 | } 15 | int Dp[3][256][256]; 16 | const int sp[8] = {2, 3, 5, 7, 11, 13, 17, 19}; // small primes 17 | vector Num[505]; 18 | int main() { 19 | ios_base::sync_with_stdio(false); 20 | cin.tie(0); 21 | cout.tie(0); 22 | cin >> N >> Mod; 23 | For(i, 2, N) { 24 | int lp = -1, j = i; // largest prime factor 25 | for(int k = 2; k * k <= j; ++k) { 26 | if(j % k == 0) Checkmax(lp, k); 27 | while(j % k == 0) j /= k; 28 | } 29 | Checkmax(lp, j); 30 | Num[lp].push_back(i); 31 | } 32 | Dp[0][0][0] = 1; 33 | For(i, 2, 500) if(Num[i].size()) { 34 | memcpy(Dp[1], Dp[0], sizeof Dp[1]); 35 | memcpy(Dp[2], Dp[0], sizeof Dp[2]); 36 | for(auto p : Num[i]) { 37 | int s = 0; 38 | For(i, 0, 7) if(p % sp[i] == 0) s |= 1 << i; 39 | _For(i, 255, 0) _For(j, 255, 0) if(!(i & j)) { 40 | if(!(j & s)) Qmod(Dp[1][i | s][j] += Dp[1][i][j]); 41 | if(!(i & s)) Qmod(Dp[2][i][j | s] += Dp[2][i][j]); 42 | } 43 | } 44 | _For(i, 255, 0) _For(j, 255, 0) 45 | Dp[0][i][j] = (1ll * Mod + Dp[1][i][j] + Dp[2][i][j] - Dp[0][i][j]) % Mod; 46 | } 47 | int Ans = 0; 48 | _For(i, 255, 0) _For(j, 255, 0) Qmod(Ans += Dp[0][i][j]); 49 | cout << Ans << endl; 50 | return 0; 51 | } -------------------------------------------------------------------------------- /Lab/Lab9/D.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | const int MaxN = 500 + 10; 12 | int N, M; 13 | char S[MaxN]; 14 | int Dp[MaxN][MaxN]; 15 | int main() { 16 | ios_base::sync_with_stdio(false); 17 | cin.tie(0); 18 | cout.tie(0); 19 | cin >> M; 20 | cin >> (S + 1); 21 | For(i, 1, M) 22 | if(S[i] != S[i - 1]) 23 | S[++N] = S[i]; 24 | For(i, 1, N) { 25 | Dp[i][i] = 1; 26 | For(j, i + 1, N) 27 | Dp[i][j] = 1000; 28 | } 29 | For(l, 2, N) 30 | For(i, 1, N - l + 1) { 31 | int j = i + l - 1; 32 | For(k, i, j - 1) 33 | Checkmin(Dp[i][j], Dp[i][k] + Dp[k + 1][j]); 34 | if(S[i] == S[j]) { 35 | For(k, i + 1, j - 1) 36 | Checkmin(Dp[i][j], Dp[i + 1][k] + Dp[k + 1][j]); 37 | For(k, i, j - 2) 38 | Checkmin(Dp[i][j], Dp[i][k] + Dp[k + 1][j - 1]); 39 | } 40 | } 41 | cout << Dp[1][N] << endl; 42 | return 0; 43 | } -------------------------------------------------------------------------------- /Lab/Lab9/Lab9-A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab9/Lab9-A.pdf -------------------------------------------------------------------------------- /Lab/Lab9/Lab9-B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab9/Lab9-B.pdf -------------------------------------------------------------------------------- /Lab/Lab9/Lab9-C.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab9/Lab9-C.pdf -------------------------------------------------------------------------------- /Lab/Lab9/Lab9-D.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/Lab/Lab9/Lab9-D.pdf -------------------------------------------------------------------------------- /Lab/temp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define For(_,l,r) for(int _ = l; _ <= r; ++_) 4 | #define _For(_,r,l) for(int _ = r; _ >= l; --_) 5 | template inline bool Checkmax(R &A, R B) { 6 | return A < B ? A = B, 1 : 0; 7 | } 8 | template inline bool Checkmin(R &A, R B) { 9 | return A > B ? A = B, 1 : 0; 10 | } 11 | int main() { 12 | ios_base::sync_with_stdio(false); 13 | cin.tie(0); 14 | cout.tie(0); 15 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Algorithm-Lab 2 | SUSTech 2023 Spring CS216 Algorithm Design and Analysis(H) 3 | 4 | ~~本来是英文的,但我英文太差还是不要恶心自己和大家了~~ 5 | 6 | 南方科技大学 2023 春季 CS216 算法设计与分析(H) 7 | 8 | 备份了所有 Lab problems 和 Assignments 以及对应的我完成的内容 9 | 10 | **一定不要**将其中的任何内容作为你自己的作业来提交,否则自负查重风险 11 | 12 | 完成情况: 13 | 14 | ![lab](labscore.png) 15 | 16 | ![assignment](assignmentscore.png) 17 | 18 | 期末考试 96 ,总评 98 19 | -------------------------------------------------------------------------------- /assignmentscore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/assignmentscore.png -------------------------------------------------------------------------------- /labscore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeerInForestovo/Algorithm-Lab/ebf27db571ec45a3af3de11e0295c33e0593301b/labscore.png --------------------------------------------------------------------------------