AlpacaHack Round 7 (Web) ã«åå ãã¾ããããã³ã¡ããçã«ã¯åãã¦ã® CTF ã®ã³ã³ãã¹ãã§ãã èªåèªã ä»åã®ã³ã³ãã¹ãã®è©± Treasure Hunt Alpaca Poll minimal-wafã»disconnection ã³ã³ãã¹ãå¾ ãããã¹ã ããã èªåèªã ã·ã§ã«ã¹ã¯ãªããã§ãã«ããâ¦
ç·å½¢ç¯©ã¨å¼ã°ãã¦ããã¢ã«ã´ãªãºã ã»ãã¼ã¿æ§é ãããã¾ãã ãç·å½¢æéã§åè¨ç®ã§ããä½ã ãããç·å½¢ä½ã ãã¨å¼ã¶ã®ã¯ä¸é©åã§ãããããããã¦ï¼*1 ãã£ããç´¹ä» æ§ç¯ã«é¢ã㦠çºå±ç·¨ å®è£ ç·´ç¿åé¡ ããã $\gdef\lpf{\operatorname{lpf}}$ ãã£ããç´¹ä» â¦
ã競ããã©ã¤ãã©ãªã«ãããæ½è±¡åã¨è¨ãã°ã»ã°æ¨ãã¿ãããªé¢¨æ½®ãã§ãã¦ããä¹ ããã§ãããäºåæ¢ç´¢ã«é¢ãã¦ããããæ½è±¡åãæèãã¦ãã人ã¯ãã¾ãå¤ããªãæ°ããã¦ãã¾ãã ãããã¡ æ´çã»è¨è¨ å®è£ ãã®ä» å®è£ ã«é¢ã㦠ä¸éå¤ã«é¢ã㦠ãæ°æã¡ã«é¢ãâ¦
C ãªãã ãã©ãçãããã¿æ¸ããã Python ã®ã³ã¼ãã gzip ã§å§ç¸®ã㦠Base64 ã§ã¨ã³ã³ã¼ããããã¤ãã復å ãã¦å®è¡ãããã¨ã§ AC ã§ãã pic.twitter.com/xsPaFGoi0uâ ãã³ã¡ãã (@rsk0315_h4x) June 8, 2024 ãåãè¾¼ã¿ããã«ããã£ã¦ãã¡ããã¨ããã³â¦
rsk0315.hatenablog.com B-tree ãæ¸ãããã¾ãèªæ ¢ãã«æ¥ã¾ãã æ¸ãã¾ãããä¸æ¦ã¯ append*1/split ã¨æ·»åã§ã®ã¢ã¯ã»ã¹ã¨ bisect*2 ãã§ããåã¨ãã¦ã® B-tree ã§ããã»ã°æ¨ã®ãããªåºé fold æ¼ç®ãã§ããæ¹ãããã®ããã¨ããæ°æã¡ãããã¾ãã ä¸å¿å®â¦
å°å ¥ é å $a = (a_0, a_1, \dots, a_{n-1})$ ã«å¯¾ãã¦é©å½ãªåºé $[l\lldot r)$ ãä¸ãããã¦ãããã§ã®å¹³åå¤ $f_a(l, r) = \tfrac1{r-l}\sum_{i=l}^{r-1} a_i$ ãèãã¾ãã ãã¨ãã° $[l\lldot r)$ ãããããä¸ãããã¦å¹³åå¤ãæ±ããã ããªããç´¯ç©åâ¦
ãã¤ã³ã¿ç³»ãã¼ã¿æ§é ï¼æªå®ç¾©ãæ°æã¡ç¨èªï¼ãæ¸ãã¾ãããã ã¾ããã ããããã åºç¤ãã¼ã ãã¼ã«ã®ç´¹ä» ç·´ç¿ãã¼ã å®è·µãã¼ã ãã¼ã¿æ§é ã«é¢ãã¦è£è¶³ åå¼·ãã¼ã ãã¨ãã ããã ã¾ããã ããã§ãã¤ã³ã¿ç³»ãã¼ã¿æ§é ã¨å¼ãã§ããã®ã¯ãé åãäºåâ¦
ããããï¼ èæ¯ æ¬é¡ ããã並å ãµãã«ã¼ãã³ ã¡ã¤ã³ å®è£ ãµã¤ãºã«é¢ã㦠å®æ¸¬ éè¨ ãã¨ãã ããã èæ¯ å®æ°æé rank/select ãã§ããç°¡æ½ãã¼ã¿æ§é ãä½ãã¨ãã®åºæ¬æ¦ç¥ã¨ãã¦ã表å¼ã (table lookup) ã¨ããã®ãããã¾ãã å°ãããµã¤ãºï¼ãã¨ãã°â¦
ãè¿ã¥ãã«ãªããã人åãã·ãªã¼ãºã§ãã ãããããªãããã¯ãè©°ãè¾¼ã¿ã¾ããããããããå ¨é¨ãç¥ããªãã¨ãããªããã®ãããªã¤ããã§ã¯ãªãããããããªãã¨ãç¥ããã£ããã«ãªã£ãããããªã¨ããæ°æã¡ãªã®ã§ããã¾ã身æ§ããã«ã¡ãã£ã¨ãã¤èªãã§ãããâ¦
ä»å¹´ããã£ã¦ã¿ã¾ã rsk0315.hatenablog.com ä»å¹´æ¸ãããã® ã«ã¹ã®è¨äº ã¯ã¦ãªããã°é¢é£ æ°ã¾ããã¢ã«ã´ãªãºã ãããããã·ãªã¼ãº æ¯ãè¿ã DP é¢é£ æ°å¼ãã¡ããã¡ã ãã©ãã¯ããã¯ã¹ã®ãåå¼· æµ®åå°æ°ç¹æ° ä»å¹´è²·ã£ããã® æ¥å¹´ã«åã㦠競ããä»¥å¤ ãâ¦
ã風åã§æãã¤ããã·ãªã¼ãºã§ãã ã§ããæä½ã¯æ¬¡ã®éãã§ãã $\texttt{new}()$ $â $ ã§åæåãã $S.\texttt{insert}(x)$ $S â S ⪠\{x\}$ ã§æ´æ°ãã $S.\texttt{remove}(x)$ $S â S \smallsetminus \{x\}$ ã§æ´æ°ãã $S.\texttt{less}(a)$ $\max {\{xââ¦
å°æ°ç¹ä»¥ä¸ãé«ã 2 æ¡ã¾ã§ããå¤ãåé²è¡¨è¨ã§ä¸ããããã¨ããããããæµ®åå°æ°ç¹æ°åã« parse ãã¦ãã 100 åããããã¨ã§ãå ã®å¤ã®å°æ°ç¹ã 2 ã¤ã¶ãåããããã®ã«ã§ãã¾ããï¼ã¨ãã話ã§ãã >>> print(f'{float("10.00")*100:.100g}') 1000 >>> prinâ¦
符å·ãªãã® 64-bit æ´æ°åã®å¤ã«é¢ãã¦å¹³æ¹æ ¹ãè¨ç®ãããå±é¢ã¯ããããããã¾ãã ããããå¤ãã®è¨èªã§ã¯ãã®ããã®é¢æ°ãç¨æããã¦ããããæµ®åå°æ°ç¹æ°åç¨ã®ã¡ã½ããã使ã人ãå¤ããã¾ãã ä»åã¯ãããããæ¹éã妥å½ãï¼ï¼èª¤å·®ãåºãããã¨ãè¸ã¾â¦
ä»®æ°é¨ã®ç²¾åº¦ã 53 bits ã®æµ®åå°æ°ç¹æ°åã§è¨ç®ããã¨ä¸è¨ã®ããã«ãªãã¾ãã >>> 1 / 49 * 49 0.9999999999999999 >>> f'{1/49*49:.100g}' '0.99999999999999988897769753748434595763683319091796875' ä»åã¯ããã«ã¤ãã¦æãä¸ãã¾ãã è¨æ³ã»åæç¥è â¦
ããã double ã§è¨ç®ããã¨ãã«å¸¸ã«çãããªãã¾ããï¼ã¨ããã¯ã¤ãºã§ãã n 㯠double ã§è¡¨ããæ´æ°ã§ãããã¨ã«ãã¾ãã çã >>> 6755399441055749 / 10 675539944105574.9 >>> 6755399441055749 * 0.1 675539944105575.0 ãããåè ã® floor ã¨å¾è ã® fâ¦
atcoder.jp å°å ¥ ããã® long double 解æ³ã«ã¤ãã¦ã®è©±ã§ããä¸è¨ã®ãããªè§£æ³ã§ãã #include <cmath> #include <cstdio> constexpr long double eps = /* ??? */; bool ok(long double a, long double b, long double c) { return std::sqrt(a) + std::sqrt(b) + eps < st</cstdio></cmath>â¦
judge.yosupo.jp ãã¡ãã§ããããã解ãã¢ã«ã´ãªãºã ã®ä¸ã¤ã¨ãã¦ä¸è¨ãããã¾ãã Kolpakov, Roman, and Gregory Kucherov. "Finding maximal repetitions in a word in linear time." In 40th Annual Symposium on Foundations of Computer Science (Cat.â¦
èæ¯ã¨ãã¦ã¯ããã¡ãã®è¨äºã§ãã rsk0315.hatenablog.com 1431655766, 1717986920, 1431655782, 1431655768, 1840700272, 1431655966, -1431655056 ãªã©ãã¾ãã¾ãªãã¸ãã¯ãã³ãã¼ãç»å ´ãã¾ãã ã$x$ ã $3$ ã®åæ°ã§ãããã¨ãããã£ã¦ããã¨ãã$1431â¦
Clang ã $\sum_{i=0}^n i$ ã $n(n+1)/2$ ã«ãã¦ããããã¨ã¯æåã§ã*1ã ã¾ãã$\sum_{i=0}^n i^2$ ã $n(n+1)(2n+1)/6$ ã«ãã¦ããã¾ãã ãã®éç¨ã§ã¯ã unsigned v1 = n * (n - 1) * (n - 2) / 2 * 1431655766u; unsigned v2 = n * (n - 1) / 2; returâ¦
ã¿ã¤ãã«æ¬ãã«ãã´ãªæ¬ã§ âM ãæ¼ãã¨ãä½ããã®åãã¯ãããã¦è¨äºãæ稿ããã¦ãã¾ãããã¶ãªãï¼ä¸æï¼ã å³ä¸ããä¸æ¸ããæ´æ°ããããï¼æ稿å¾ç·¨éä¸ã®ï¼ãæ´æ°ãããã§ãã£ã¦ããããªãã
競ãã er ã¯ããè¨ç®éã®è¦ç©ããããã¾ãããããããã®è¨ç®é㯠$O(\dots)$ ãªã®ã§ååé«éã§ãããã¨ãã£ãå ·åã§ä¸ããæãããã¨ãå¤ãã§ãã ã¾ãããããããã®è¨ç®é㯠$\Omega(\dots)$ ãªã®ã§ TLE ããããã¨ãã£ãå ·åã§ä¸ããæãããã¨ããã°ãâ¦
â ããã hello ã«ãªã£ã¦ããã°åã¡ zzz â æ¬ä¼¼ã³ã¼ãã render ããã¦ããã°åã¡ function $\textsc{Identity}(x)\colon$ return $x$
å æ¥ãä¸è¨ã®è¨äºã§ããããµãã¯åé¡ã® DP ãæç´ã«çºãã¾ããã rsk0315.hatenablog.com ä»åã¯ãããããµãã¯åé¡ã«éããæ§ã 㪠DP ãæç´ã«çºããåã§ãã ãââï¼ä½ããã®éåï¼ã®æ大å¤ãã®ããã«è¨ç®ãããââã®é¨åã«ã¤ãã¦èãã¦ããã¾ãã ãã¡ãã â¦
å ¸åç㪠DP ã®å®è£ ã®å±æ§ã®ä¸ã¤ã¨ãã¦ãé ã DPã»ããã DP ã¨å¼ã°ãã¦ãããã®ãããã¾ãã ããã DP ãéãã DP ã¨å¼ã¶æ´¾é¥ããã£ãæ°ããã¾ãããããã§ã¯å称ã«ã¤ãã¦ã®è°è«ã¯ãã¾ããã å°å ¥ 主張 ä¾ ããããµãã¯åé¡ Eratosthenes ã®ç¯© åæ°ã®æå¾ â¦
ããæ£ç¢ºã«ã¯ãABC ã® AâE ãããã¾ããã èªå·±è¯å®æãä½ãããä½ã ãããã¾ãããã¨ããã¨ãã«ãã¾ã ããã¦ãªãã£ãã®ããã¨ãã声ãèªåã®ä¸ããèããã¦ããã¿ã¤ãã®äººããããªãã«ããã®ã§ã¯ãªãã§ããããããã³ã¡ããã¯ãããã人ã§ãã ä»ã®äººãããâ¦
ABC 204 E ã«é¢é£ãã¾ãã å®ç¾© è¡¨è¨ æå³ ä¾ $\floor{x}$ $x$ 以ä¸ã®æ大ã®æ´æ° $\floor{3.1} = 3$, $\floor{2.7} = 2$, $\floor{-2.2} = -3$, $\floor{2} = 2$ $\ceil{x}$ $x$ 以ä¸ã®æå°ã®æ´æ° $\ceil{3.1} = 4$, $\ceil{2.7} = 3$, $\ceil{-2.2} = -2$, â¦
åçè¨ç»æ³ (dynamic programming, DP) ã¯ã¤ã¡ã¼ã¸ã»ã¡ã³ã¿ã«ã¢ãã«ãæ´ãã¾ã§ã®ãã¼ãã«ãä¸ã é«ããããªæ°ããã¾ãã ä¸ä¾ã示ãã¾ãããå¿ ãããå ¨é¨ã®åé¡ãä¸è²«ãã¦èª¬æã§ããã¨ã¯éããªãã®ã§ãããã¤ãã®ã¤ã¡ã¼ã¸ãæã£ã¦ããã¨ããããããã¾ããï¼â¦
æè¿è©±é¡ã®å½¢å¼çåªç´æ° (FPS) ã§ããæè¿ã¨è¨ãã¤ã¤ 4 å¹´ãããåããæµè¡ãå§ãã¦ããæ°ããã¾ããå½æã¯ãæ¯é¢æ°ãã¨å¼ãã§ãã人ãå¤ãã£ãæ°ããã¾ãã ä»åã¯ãFPS ã§èå¯ããã¦ãã¦ã$\frac{\dd}{\dd x}y = f(y)$ ãªã FPS $y(x)$ ã«å¯¾ã㦠$y(x)\bmoâ¦
ä½ããã®é åºãæã£ãå T: Ord ããã£ã¦ãããã«é¢ããä½ããã®ï¼å¤éï¼éåã®ä¸å¤®å¤ãæ±ããã©ã¤ãã©ãªãä½ãããã¨ãã¾ãã ãã¨ãã°åã«é å a: [T] ã®ä¸ããä¸å¤®å¤ãæ¢ãã ãã ã£ãããa: [T], b: [T] ãã a[i] + b[j] ã¨ãã¦èãããããã®ã®ä¸å¤®å¤ (â¦
ã«ãã´ãªã¼æ©è½ã使ã£ã¦ããªãã£ãã®ã§ã使ãã¨ä¾¿å©ãªã®ã§ã¯ï¼ã¨æãã¾ãããåè«ã¨ã¯é¢ä¿ããªãããããã¾ããã