ãã®è¨äºã¯ãCompetitive Programming Advent Calendar 2016 - Adventarã®15æ¥ç®ã®è¨äºã§ãã
ãã®è¨äºã«ã¤ãã¦
å»å¹´(2015å¹´)ã®12æããããã»ã°ã¡ã³ãæ¨ãä»»æã®ã¢ãã¤ãã«å¯¾ãã¦ä½¿ããã¨ãã(å½ããåã®ãã¨ã)æ示çã«æ¸ãããæ¥æ¬èªã®è¨äºããªããªããã¨æããã(å½æ)æ¥å¹´ã®Advent Calendarãããã«æ¸ããããã¨æã£ãã®ã§æ¸ãã¾ããããã®å¾èª¿ã¹ã¦ã¿ã¾ããããã©ããããã®1å¹´(2015å¹´12æ-2016å¹´12æ)ã§å²ã¨æ¸ãããããã§ããã(ãã®è¨äºã®æå³ã¨ã¯â¦)
åè¿°ã®ããã«å¤æ°ã®è¨äºããã®1å¹´éã§åºãã®ã§ããã®è¨äºã¯ä¸»ã«ãããã¸ã®ãªã³ã¯ãè²¼ããå ´åã«ãã£ã¦ã³ã¼ããç´¹ä»ãããã¨ã«ãã¾ãã
ãã¼ã¿æ§é ã¨ä»£æ°æ§é
ã»ã°ã¡ã³ãæ¨ <=> ã¢ãã¤ã
éåMãMã®è¦ç´ eã¨ãã®ä¸ã®äºé æ¼ç®*ãããã*ã
- e * x = x * e = x *1
- x * (y * z) = (x * y) * z
ãæç«ããå ´åã(M, e, *)ã¯ã¢ãã¤ãã§ããã¨ããã
ã¢ãã¤ã(M, e, *)ã«å¯¾ãã¦ãã»ã°ã¡ã³ãæ¨ã¨ãããã¼ã¿æ§é ã§ãMã®å
ãããªãé
åã表ç¾ã§ããããã®ãã¼ã¿æ§é ã¯æ§ç¯ãO(n)ã§ã§ãã1è¦ç´ ã®æ´æ°ã¨åºéã«å¯¾ãã*ã®æ¼ç®(åºéå*2 )ãO(log(n) )ã§ã§ããã(nã¯é
åã®é·ã)
詳ããã¯ãããã¿ã¦ãã ãã:
qiita.com
qiita.com
BIT <=> ã¢ã¼ãã«ç¾¤
(å
é ããã®ç´¯ç©åãè¨ç®ããã ããªãå¯æã¢ãã¤ã(= ã¢ã¼ãã«ç¾¤ - éå
= ã¢ãã¤ã + å¯æå¾)ã§ãã)
ã»ã°ã¡ã³ãæ¨ã¨åããæ§ç¯O(n)ã1è¦ç´ ã®æ´æ°ã¨åºéåãO(log(n))ã§ã§ããã
ã¢ã¼ãã«ç¾¤ã®ä¸ã®ç´¯ç©åã使ãåé¡: è»æ¬ãã¿ã¦ãã ããããã®ä»èªåã解ããåé¡ã®ä¸ã§:
C: データ構造 - AtCoder Regular Contest 033 | AtCoder
C: 転倒距離 - AtCoder Regular Contest 043 | AtCoder
No.449 ゆきこーだーの雨と雪 (4) - yukicoder
ãµã³ãã«ã³ã¼ã
é 延ã»ã°ã¡ã³ãæ¨ <=> ä½ç¨ä»ãã¢ãã¤ã
データ構造と代数(後編) · tomcatowl's blogã«è©³ããæ¸ãã¦ããã®ã§ãåç §ããããã
ãµã³ãã«ã³ã¼ã
ãã°ã£ã¦ããã®ãããªãã®ã§æ²è¼ã§ãã¾ããâ¦(>_<)
SparseTable <=> 交ååæ(meet-semilattice)
éåAã¨ãã®ä¸ã®äºé æ¼ç®/\ããããããã
- idempotency (ã¹ãçå¾) a /\ a = a
- commutativity (å¯æå¾) a /\ b = b /\ a
- associativity (çµåå¾) a /\ (b /\ c) = (a /\ b) /\ c
ãæºããå ´åã(A, /\)ã¯äº¤ååæã§ããã¨ããã
交ååæã«ã¤ãã¦ã¯ãSparseTableã¨ãããã¼ã¿æ§é ãã¤ãã£ã¦ãæ§ç¯O(n * log(n)), åºéã¯ã¨ãªO(1)ã§è¨ç®ãã§ããã(æ´æ°ã¯ç¡ç)
ãã¤ã¯ã¹ãã©æ³ <=> closed semiring (è¥å¹²ãã¾ã)
ãã¤ã¯ã¹ãã©æ³ãsemiring (R ⪠{â}, min, +, â, 0) *3ã®semiringæ§é ã®ä¸ã§æãç«ã£ã¦ããã¢ã«ã´ãªãºã ã§ãããã¨ã¯ããç¥ããã¦ããããããä¸è¬åããclosed semiringã¨ããã¯ã©ã¹ã«å«ã¾ããä»»æã®semiringã§ä¼¼ããããªãã¨ãã§ãããããã("closed"ã¨ããã®ã¯ããã¤ã¯ã¹ãã©æ³ã®ä¸ã§è¦è«ãããè²ã ãªè¦è«ãæºããåãæ±ããããæ§è³ªã®ãã¨ã§ããã) 詳ããã¯(Mohri, 2002)ãåç §ããããã
(2016/12/15 12:50追è¨)ãµã³ãã«ã³ã¼ã
C++: contest/dijkstra.cpp at master · koba-e964/contest · GitHub
Scala: contest/Dijkstra.scala at master · koba-e964/contest · GitHub
Rust: contest/Dijkstra.rs at master · koba-e964/contest · GitHub
åè
å²ã¨å
容ã被ã£ã¦ãã+ä¸å¯§ãªè¨äºãã¿ãªããèªãã¹ãã
tomcatowl.github.io
tomcatowl.github.io
(2016/12/16 16:50追è¨)
ç¿æ¥ã¯古寺いろは@競プロ応援アカウントããã®AtCoderに毎回参加したくなる仕組みã¨ã@ainu7ããã®è¨äºã§ãã
*1:2016/12/15 1:39ä¿®æ£:e -> x,åç´ãªèª¤ã
*2:æ¬æ¥ã¯å¯æã§ãªãæ¼ç®ã«ãåãã¨ãã表ç¾ã使ãã®ã¯æã¾ãããªãã®ã§ããã以ä¸ã§ç´¹ä»ããBITã«ãããèªæ³ã¨æ´åããããããåºéåãã¨å¼ãã§ãã¾ã
*3:ãã®semiringã«ã¯Tropical Semiringã¨ããååãä»ãã¦ããã