2021-01-01ãã1å¹´éã®è¨äºä¸è¦§
èªåèªãè¨äºã§ãã ãã³ã¡ããã®ä¸å¹´ãæ¯ãè¿ãè¨äºããã£ããæ¸ãããã«ãªã£ããã©ãå·éã«ãªã£ãã®ã§å´ä¸ããâ ãã³ã¡ãã (@rsk0315_h4x) 2021å¹´12æ16æ¥ ãã£ãããç´ãã¾ããã ä»å¹´ãåå¼·ãããã® æ°å¦é¢é£ã®ãã®ãããã¤ãå¦ãã ããæããã£ãæ°ã«â¦
競ãã er ã®éã§ã¯ãï¼ä¸»ã«å®çæ´»ã§ï¼æé©å¤ãæ¢ããã¨äºåæ¢ç´¢ããã¦ãä¸éã大ããåããããããã«ç ´æ» ããã¨ããå®çªãã¿ãããã¾ã*1ã ãããã¯ãå®éã®ã³ã³ãã¹ãã§ããä¸éãå°ããããããä¸éã大ããããããããå¤å®é¢æ°å ã§ãªã¼ãã¼ããã¼ããâ¦
夢ã«åºã¦ãã競ããã®åé¡ãèªæãæ¢åºã #P-complete ãã¡â ãã³ã¡ãã (@rsk0315_h4x) 2021å¹´11æ23æ¥ ä»åã¯ããã¨é¢ç½ããã¤åºããï¼ã¨æã£ã¦èãã¦ããã ãã©ãå¯èµ·ãã§é ãã¤ãã¦ãªãã£ãã ãã§èªææ ã ã£ããã¨ãå¤æãã¤ã¤ããâ ãã³ã¡ãã (@rsk031â¦
ããããªã人ã¯èªã¾ãªãã¦ããã§ãã TL; DR vEB ããããã㨠Python ã® set ã¯ãx 以ä¸ã®æå°å¤ã¯ï¼ããx ãã大ããæå°å¤ã¯ï¼ãã¨ãã£ãã¯ã¨ãªã«çããããªãã®ã§å°ãã¾ããããããããã§ããx ã¯æ´æ°ã¨ãã¡ããã¾ãã ç¹ã«ç«¶ããã®æèã®è©±ãªã®ã§ãå¤â¦
æãã¤ãããæ¸ãã¾ãã ããã¯ãªã« ãªã«ããæãã¤ããã¨ãã«ãææãããåã«ããã¼åããããããã¨ããã®ã«æ°ã¥ãç¨ã®ãã¼ãã§ãããã¨ä»äººã®åèå¯ãè¦ãã®ã¯ãã®ããã åèå¯ åèå¯ãã¡ã§ãã \(n^{1/2}-n^{1/3}=O(n^{1/3})\) \(n^{1/2}-n^{1/3} = nâ¦
è¨ç®éã«ã¤ãã¦ã®ã話ã§ãã対象ã¯ãããã°ã©ãã³ã°çµé¨ã¯ãããè¨ç®éã®ãã¨ãç¥ããªãåå¿è ãããè¨ç®éã®ãã¨ãç¥ã£ã¦ããã¤ããã«ãªã£ã¦ããä¸ç´è ãããã§ãã æ°å¼ãè¦ãããªã人ã«ã¨ã£ã¦ã¯èªãã®ã大å¤ããã§ãããæ·±å¼å¸ãã¤ã¤è½ã¡ã¤ãã¦èªãã§ããâ¦
æè¿ããªãããã¾ã人æ°ãªããªãï¼ TL; DR ããªã + ã«ã¶ãã 㧠\(O(\log(n))\) æéã§å¤§å°æ¯è¼ã§ããã®ã§ãæç´ã«æ¯è¼ãã代ããã«ããã使ã£ã¦ã½ã¼ãã㦠\(O(n\log(n)^2)\) æéã§æ§ç¯ã§ããã ãããã ããªã ããªã (rolling hash) ã®ããããã軽ãâ¦
rerooting DPãrerooting ããã DPãDP with rerooting ã¨ããªãå¥ã«ããããã å ¨æ¹ä½æ¨ DP èªä½ãæãã¦ãrerootingãã¨è¨ãããã¨æ°ã«ãªãã¾ãã rerooting ã¯æ¨ã®æ ¹ãå¤ããæä½ï¼å ¨æ¹ä½æ¨ã®ä¸ã§èããããï¼ãæãã¦ãã¦ãå ¨æ¹ä½æ¨ DP èªä½ã®ãã¨ãæâ¦
ã¤ã³ã¿ã©ã¯ãã£ãåé¡ã¯æå ã§ã®ãããã°ãé¢åãã¡ãªã®ã§ãããã ã¨æã£ã¦ãã人ãå¤ããã§ãã coproc ã¨ããã·ã§ã«ã®æ©è½ã使ãã°ããããç°¡åã«ã§ããªãããªï¼ã¨æã£ãã®ã§ãæ¸ãã¦ã¿ã¾ãã ã¾ããã ç°¡åã¨ã¯è¨ã£ã¦ãã以ä¸ã®ãã®ã¯èªåã§æ¸ã or çæâ¦
part 1 以éããããã¯ãããã¾ããã å°å ¥ï¼ 競ããã§ãã絶対誤差ã¾ãã¯ç¸å¯¾èª¤å·®ã \(10^{-6}\) 以ä¸ãªãã°æ£è§£ã¨å¤å®ããããã¨ãã£ãæè¨ã¯ã¡ããã¡ããè¦ããã¾ãã æãåºãã·ãªã¼ãº \(2e-3\) atcoder.jp æã²ã§ãããã pic.twitter.com/64N0Qk3SbXâ â¦
ãbitset 㧠64 åé«éåã§ãã¾ããã64 ã¯å®æ°ãªã®ã§ãªã¼ãã¼ã¯å¤ããã¾ãããã®ãããªèª¬æã¯ã競ããçéã§ãã³ãã³è¦ããã¾ãã 59 æ¥ç®ã®è§£èª¬ã§ããstd::bitset ãªã©ã使ã£ãé«éåãã¯ããã¯ã¯éå»ã« AGC ã«ãåºé¡ããããã¨ãããéè¦äºé ã§ãã®ã§ãçâ¦
\(n\) 以ä¸ã®ç´ æ°ã®åæ°ãæ±ããé¢æ° \(\pi(n)\) ãæã£ã¦ããã¨ãã¾ãã ãã®ã¨ãã\(n\) ã®ç´ æ°å¤å®ã¯ \(\pi(n)-\pi(n-1) = 1\) ãã©ããã§ã§ãã¾ãã fn is_prime(n: usize) -> bool { n > 0 && prime_pi(n) - prime_pi(n - 1) == 1 } ãã¨ãã° \(O(n^{3/â¦
軽ãã®è¨äºã§ãã \(n\) çªç®ã®ç´ æ°ã \(p_n\)ã\(n\) 以ä¸ã®ç´ æ°ã \(\pi(n)\) ã¨æ¸ãã¨ãã¾ãã ãã®ã¨ãã\(p_n\) 㯠\(\pi(p_n) \ge n\) ã㤠\(\pi(p_n-1) \lt n\) ãæºããã¾ãã ãã£ã¦ãããã¯äºåæ¢ç´¢ã§æ±ãããã¾ãã ä¸éã決ããã®ã大å¤ããã§â¦
å¥ã«ãããµã¨ãããåºãããªãæã¨ãã«æ°ãã¦ãããã¨æãã¾ãã \(n\) 以ä¸ã®ç´ æ°ã®åæ°ãæ°ãããã¨ãã©ããã¾ããï¼ åæ´æ° \(2\le i\le n\) ã«å¯¾ãã¦ç´ æ°å¤å®ãã¦æ°ãã¾ãï¼ ç´ æ°å¤å®ã試ãå²ãæ³ã§ãã㨠\(\Theta(n\sqrt{n})\)ãç·å½¢ç¯©*1ã使ãã° \(\Tâ¦
ã©ããã¦ãããªãã¨ã«... ã¾ããã æ¬é¡ ãªãã©ã«ã®ã¤ãããã std::max scanf / printf int8_t ACL ã®è©± ããããå®ç¾©ãããªãå¦çç³»ããã ãã®ã»ã ãããã® ã¾ããã C++ ã«ã¯æ¬¡ã®åãããã¾ãï¼ signed char unsigned char char short signed int (= shâ¦
ãã¼ããããã§ãã ãã³ã¡ããã®ä»ã®åå è¨ã¯ ãããã*1ã ãã³ã¡ãã㯠B3 ã®é ãã ICPC ã«åºã¦ãã¾ããã four-t 㧠3 åã¨ãä»å tsutaj ã§åºã¾ããããã¼ã ã¡ã¤ãã«å¤§å¤æµã¾ãã¦ãããªãã¨ããã®ãã¨ã¦ãæãã¾ãã ä»åã§è害åã§ãã tsutajï¼ãã¼â¦
ãåºã«å ¥ãã¨ãã«ãã¢ãéãã¦ããã確èªããã«æ©ãã¦ãã£ã¦ããã¢ã«ã¶ã¤ãã£ã¦æã£ã¦ãã人ãããããããã話ãããªãã§ãã*1ã æªå®ç¾©åä½ãèµ·ããã¦æãã®ã¯ããã¨ä¼¼ã¦ããæ°ããã¾ãã 競ããã§ããããã³ã¼ãã¼ã±ã¼ã¹ãªã©ãåãã§ãã ããã¾æ¸ãã¦ãâ¦
çµç·¯ ãªã¼ãã¼ããã¼å¤å®ãåãããªã人ã®ããã®ã¹ã©ã¤ããªã¼ãã¼ããã¼å¤å®ã»ãªã¼ãã¼ããã¼å¤å®ãããããªã人ã¯ä¸ ( â â¿â )â 大人ãã Python ã§ã使ã£ã¦ãã»ãæ¸ è´ãããã¨ããããã¾ããâ ãã³ã¡ãã (@rsk0315_h4x) 2021å¹´2æ20æ¥ ä»æ¥ã¯å°ãã ãçé¢ç®â¦
ACL (AtCoder Library) ã®å é¨å®è£ ãç¥ããã人åãã®è¨äºã§ãã ãåã ã¡ã«ããã¼ããACL ã®ãã®é¢æ°ã£ã¦ã©ãããä»çµã¿ãªã®ï¼ ç¥ã£ã¦ããããªãï¼ãã¨èãããã¨ãããã... ãªããã»ããããããªããã©ãéæ³ã§åããããããã ããã¨ããè¨ããªãã¨æ ãâ¦