2023-08-01ãã1ã¶æéã®è¨äºä¸è¦§
äºé辺é£çµæåå解ã¨ã low-link ã¨ãè²ã èãããã©ãçµæçã«æå¾ã¯ããã DFS æ¨ãä½ãã ããã«ãªãã¨ããããããå°è±¡çãªåé¡ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ä»¥ä¸ ä»¥ä¸ã®æ´æ°ãããªããµã¤ãº ã® 2 ã¤ã®æ°å ã ãä¸ããããã ä»ã0 㨠1 ã®ã¿ãããªããµã¤â¦
åè§ã½ã¼ãã® verify åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ äºæ¬¡å å¹³é¢ä¸ã« åã®ç¹ãä¸ãããããåç¹ã®åº§æ¨ã¯ ã§ããããããã®ç¹ãåè§ ( ã¨ãã) ãå°ããé ã«ã½ã¼ãããã ãã ããç¹ ã®åè§ã¯ ã§ããã¨ãããã¾ããåè§ãçããç¹ã®é åºã¯åããªãã å¶ç´ èãããâ¦
Library Checker ã¨ããã¨é£ããã¤ã¡ã¼ã¸ããããã©ããã®åé¡ã®ããã«åºæ¬çãªåé¡ããããã§ãããæçè·¯ã®å¾©å ããè¦æ±ããåé¡ã¯æå¤ã¨å°ãªãã®ã§ãã¨ã¦ãè²´éãªåé¡ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ é ç¹æ° ãè¾ºæ° ã®åç´ãªéã¿ä»ãæåã°ã©ããä¸ãããããâ¦
ããã§ã¯ ã®è¨ç®éã®è§£æ³ãå®è£ ãããæ¬å½ã¯ FPS ã使ãã° ã®è¨ç®éã§ã§ããã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ éè² æ´æ°å¤ ãä¸ããããã ã®åå²æ°ã 998244353 ã§å²ã£ãä½ããæ±ããã å¶ç´ èããã㨠ããã§ã¯ããã®è¨äºã«æ¸ãã ã®è¨ç®éã®è§£æ³ãå®è£ ããã qâ¦
å¼·é£çµæåå解㮠verify åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ åç´ã¨ã¯éããªããé ç¹æ° ãè¾ºæ° ã®æåã°ã©ããä¸ããããã ãã®ã°ã©ããå¼·é£çµæåå解ãã¦ããããã¸ã«ã«ã½ã¼ãé ã«åºåããã å¶ç´ è§£æ³ ã¾ããå¼·é£çµæåå解èªä½ã®æå³ã¯æ¬¡ã®è¨äºã«æ¸ããã drken1â¦
ãäºé ä¿æ° mod ç´ æ°ãã verify ããåé¡ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ç´ æ° ãä¸ãããããæ´æ° ã®çµã çµä¸ããããã®ã§ãããããã«ã¤ã㦠ã ã§å²ã£ããã¾ããæ±ããã å¶ç´ è§£æ³ ããã§æ¸ããæ¹æ³ãå®è£ ãããã¨ã§ AC ã§ããããã ããmodint ã¯èªåã®ãã®â¦
é¢ç½ãã£ã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ã®ã°ãªããããããåãã¹ã«ã¯æ°å¤ãæ¸ããã¦ããã åã®æ°å¤ãéããã¨ã ã åãã¤ããã ä»ãåè¡ã«ã¤ãã¦ããã® åã®æ°å¤ãèªç±ã«ä¸¦ã³æ¿ãã¦ããã ãã®çµæã¨ãã¦ããã¹ã¦ã®åã ã®é åã§ããããã«ãããã¨ãå¯è½â¦
å°æ¥ããç©ã®åãã¿ã°ãéããã¨ãã«ãæãå ¸åçãªåé¡ãç®ã«å ¥ãããã«ããªããäºé ä¿æ° ã ã¨è¡¨è¨ãããã¨ã«ããã åé¡æ¦è¦ é·ãã ã§ç·åã ã§ãããããªãæ£ã®æ´æ°ã®ã¿ãããªãæ°å 㯠éãèãããããããããã¹ã¦ã®æ°åã«ã¤ãã¦ã® ã®ç·åã 9982443â¦
FPS + è² ã®äºé ä¿æ° åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ é·ãã ã§ç·åã ã§ãããããªãæ£ã®æ´æ°ã®ã¿ãããªãæ°å ãã¹ã¦ã«ã¤ãã¦ã® ã®ç·åã 998244353 ã§å²ã£ããã¾ããæ±ãã ( ã±ã¼ã¹)ã å¶ç´ è§£æ³ (1)ï¼FPS æ±ããããã®ã¯ ã§ãããããã¯ã¡ããã¨è¨ç®ããã¨ã â¦
ã¢ãã°ãµç¤¾å ã§ååã¨ä¸ç·ã«è§£ããï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ è¦ç´ ãããªãæ°å ãä¸ãããããå ã«å¯¾ãã¦æ¬¡ã®åã«çããã å æã¨å¾æã交äºã«ãã¬ã¤ãããæ´æ° ã管çãããæå ã§ããã å æã¯åæ㯠ãé¸ã³ã 㨠ã«æ´æ°ããæ°åãããã®æ´æ°ã¯åé¤ãâ¦
åºéåå²ããã¦ãã DP ã¨ãã¦ãä¸çªæåã«è§£ãã¹ãåé¡ãæå³ãã¦ä½ã£ãï¼ï¼ ããã¡ããæ¬ã® 3 ä¾é¡ (ããããµãã¯åé¡ãç·¨éè·é¢ããã) ã® 1 ã¤ã§ãããã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ åã®è¦ç´ ãä¸åã«ä¸¦ãã§ãããããã åã®è¦ç´ ã«å¯¾ãã¦ãåºé ã®ã³ã¹ãâ¦
ãã£ã¡ããã Greedy åé¡ã ã£ãï¼ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ åã®ååãããã çªç®ã®ååã¯ãä¸è¬å®¢ã¯ åã§è³¼å ¥ã§ããMMA é¨å¡ã¯ åã§è³¼å ¥ã§ããããªããMMA é¨å¡ãä¸è¬å®¢ã¨æ¯ã¹ã¦å¾ã§ããååãããå¾ã¦ãæããååãããå¾ãã 人ããã¦ã 人ç®ã¯ãä¸â¦
ã¤ãæè¿ CodeQUEEN 決å E åé¡ã§ãåºã¦ãããæ大å¤ã®æ大åãå ¸åãã¯ããã¯ï¼ï¼ï¼ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ é·ã ã® 2 ã¤ã®æ°å 㨠ãä¸ãããããä»ãäºãã« disjoint ãªåºé群 ãã¨ã ( ã¯èªç±)ããã ããåºéã®é·ãã®ç·åãã¡ããã© ã¨ãªãããã«ãâ¦
åºéãæ´çããèãæ¹ã楽ããã£ãã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ä¸å³ã®ããã« çµã®ãé»ãåºéãã¨ã赤ãåºéããããã赤ãåºéã¯é»ãåºéã«å®å ¨ã«å å«ããã¦ããã ãã®åºéä¸ã§ã³ããåããã¦ãããã³ãã çªç®ã®é»ãåºéã®å é¨ã«ããã¨ãã çªç®ã®èµ¤ãåºéâ¦
æ¬å½ã«ä¸åæ¢ç´¢ã§éãã®ãï¼ ãããã®åé¡ãæãåºãã drken1215.hatenablog.com drken1215.hatenablog.com åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ äºæ¬¡å å¹³é¢ä¸ã« æ¬ã®ç·åãããããã®å¹³é¢ä¸ã®åç¤ (åå¨ã¨å é¨ãå«ã) ã®ãã¡ã æ¬ã®ç·åãã¹ã¦ã¨å ±æç¹ããã¤ãããªãâ¦
ããããã¯ã¿ã¼ã§é«éåããã®ã¯ããã¤ãè¦è½ã¨ãã¦ãã¾ãï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ åç°ç¶ã« åã®éæ³ç³ãããã çªç®ã®éæ³ç³ã¯ã価å¤ã ãè²ã ã§ãããè²ã¯ 1 ä»¥ä¸ 50 以ä¸ã®æ´æ°ã§è¡¨ãããã ä»ããããã®éæ³ç³ã«å¯¾ãã¦ãé£ãåãéæ³ç³ã®è²ã®å·®ã â¦
æ´æ°ã®å ¥éã«ããæãã®åé¡ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ æ£ã®æ´æ° ã¨éè² æ´æ° ãä¸ããããã次ã®æ¡ä»¶ãæºããæ£ã®æ´æ° ã®åæ°ãæ±ããã ã ã§å²ã£ãä½ãã ã§ãã å¶ç´ è§£æ³ ã ã§å²ã£ãã¨ãã®åã ã¨ããã¨ã ã¨è¡¨ããããããå¼å¤å½¢ãã㨠ã¨ãªãããã®â¦
平衡ä¸é²æ³ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ 次ã®æ¡ä»¶ãæºãããµã¤ãº 9 ã®æ´æ°å ãæ±ããã ã§ãã ä»¥ä¸ ä»¥ä¸ã®ä»»æã®æ´æ° ã«å¯¾ãã¦ã次ã®æä½ãç¹°ãè¿ãæä½åãåå¨ãã¦ãæ´æ°åä¸ã«æ´æ° ãåå¨ããç¶æ ã«ã§ãã æä½ 1ï¼æ°åãã 2 ã¤ã®è¦ç´ ãé¸ã³ããã® 2 â¦
for æã®ç·´ç¿åé¡ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ 人ã®ãã¹ãã®å¾ç¹ ã®ãã¡ã ç¹æªæºã®ãã®ãä½åããããçããã è§£æ³ for æãç¨ãã¦ã ã§ãããã㪠ã®åæ°ãæ°ããã°ããã ã³ã¼ã #include <bits/stdc++.h> using namespace std; int main() { // å ¥å int N, P; cin >> N ></bits/stdc++.h>â¦
Z-algorithm ã Suffix Array ã使ããé¢ç½ãæååæ¤ç´¢åé¡ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ è±å°æåã®ã¿ãããªãé·ã ã®æåå ãä¸ããããã次ã®æ¡ä»¶ãæºããæåå ã®çµãä½åããããçããã ã¯ãããã空æåã§ã¯ãªã ã§ãã å¶ç´ èããã㨠ãã®æã®åâ¦
ã¾ã 1 ã¤ãMST ç³»ã®åé¡ã®ã¹ããã¯ãå¢ãããã§ãå®è³ªçã«ã¯æ´æ°åé¡ã ã£ãã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ é ç¹æ° ãè¾ºæ° ã®ã°ã©ããããããã®ã°ã©ãã«ä»¥ä¸ã®æä½ ãå®æ½ãããã¨ã§éã¿ä»ãç¡åã°ã©ããä½ãã ã«å¯¾ãã¦ãé ç¹ ã¨é ç¹ % ã®éã«ãéã¿ ã®è¾ºãå¼µâ¦
2-SAT ã®ãå¯ãã解æ¶ããç´¯ç© OR ãã¯ãå¦ãã ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ æã®ã«ã¼ããããã表ã«ã¯ ãè£ã«ã¯ ãæ¸ããã¦ãããåã«ã¼ãã«ã¤ãã¦ã表ãä¸ã«ããããè£ãä¸ã«ããããé¸æãã¦ããã ä¸æãé¸æãããã¨ã§ãä¸ãåãã¦ããæ°å¤ãã©ã® 2 ã¤ãâ¦
floor sumï¼ï¼ï¼ ã³ã³ãã¹ãä¸ã«æãã¤ãã¦ããã£ãï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ ç¿ ããã£ã¦ãç¿ ã«ã¯ åã®ç³ãä¹ã£ã¦ãããã¾ãã空ã®è¢ãããã ããªãã¯ä»¥ä¸ã® 2 種é¡ã®æä½ã好ããªé çªã§ 0 å以ä¸ä½åº¦ã§ãè¡ããã¨ãã§ããã ç³ã 1 å以ä¸è¼ã£ã¦ããç¿â¦
lca ã®åé¡ãªã¹ãã«è¿½å ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ é ç¹æ° ã®æ¨ã¨ã2 é ç¹ ãä¸ãããããå ã«å¯¾ãã¦ã以ä¸ã®åãã«çããã ãã¹ - ã¨ããã¹ - ã®ä¸¡æ¹ã«å«ã¾ããé ç¹ã®åæ°ãçãã å¶ç´ èããã㨠é ç¹ ãå§ç¹ã¨ããæ ¹ä»ãæ¨ãä½ã£ãããããããããã¨â¦
ããããã®è©°ããã®æéãããããµã³ãã«ãå¼±ãã®ã§ãæç´ã·ãã¥ã¬ã¼ã·ã§ã³è§£ãå®è£ ãã¦ãããã¨ã®ä¸è´ã確ãããããªã©ããï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ '1'ã'9' ã®ã¿ãããªãæåå ãä¸ããããããã®æååã«å¯¾ãã¦æååãè¿ãé¢æ° ãããã ã¯æ¬¡ã®æä½â¦
ã¿ãããªé£ç«æ¹ç¨å¼ã解ããçµé¨ãããã°ãæãã¤ãããããããããªãã åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ (ã¤ã³ã¿ã©ã¯ãã£ã) 0 㨠1 ã®ã¿ãããªããµã¤ãº ã®æ°å ãããããæªç¥ã§ãããããã¤ã質åãç¹°ãè¿ããã¨ã§ããã®æ°åãç¹å®ãããã æ大㧠åã¾ã§è³ªåãâ¦
ã¡ããã¨è¨¼æããªãã¨ããªããªãå®å¿ãã¦æåºã§ããªãç³» åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ æ´æ°å ãä¸ããããã次ã®æä½ãç¹°ãè¿ãè¡ã£ã¦ã ã®æ大å¤ã¨æå°å¤ã®å·®ã 1 以ä¸ã¨ãªãããã«ããããå®ç¾ã®ããã®æä½ã®æå°åæ°ãæ±ããã ãé¸ãã§ã ã« 1 ã足ãã ãâ¦
æ³å®è§£æ³ã天æçã«æããã¨ãã¦ããæç´ãªã°ã©ãæ¢ç´¢ã§ã解ããï¼ æã«ã¯è åã§é å¼µãã®ãæå¹ï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ 競æããã°ã©ã ãããã çµã«ã¤ãã¦ã¯ãã©ã¡ããå¼·ãããåãã£ã¦ãããå ·ä½çã«ã¯ ã«å¯¾ã㦠ã¯ã ããå¼·ã ã¨ãããã¨ãåãã£ã¦â¦
ãããã¿ã¤ãããå ´åã«æ³¨æï¼ åé¡ã¸ã®ãªã³ã¯ åé¡æ¦è¦ (0 å§ã¾ãã«è¡¨ç¾æ¹) 人ã®äºº ãããã人 ã®ããã°ã©ãã³ã°å㯠ã§ããã 人 ã¯å¿ è¦ã«å¿ãã¦ããã°ã©ãã³ã°åãéãããã¨ã§ã 人ã®ä¸ã§åç¬ãããã«ãªããã¨ãã¦ããã ãã®ããã«ããã°ã©ãã³ã°åããâ¦
çµè« å ã«çµè«ããã ãªãã©ã« ã«å¯¾ãã¦ã以ä¸ã®æ¡ä»¶ A, B, C ã¯åå¤ã§ããã Aï¼ ã®ãã¡ãTrue ã§ããã®ã¯ 1 å以ä¸ã§ãã Bï¼ä»»æã® () ã«å¯¾ãã¦ãç¯ ãå 足ãã Cï¼æ°ããªãªãã©ã« ã®å¤ãé©åã«å®ããã¨ãã以ä¸ããã¹ã¦å 足ãã 1ï¼ç¯ () 2ï¼ç¯ () 3ï¼ç¯â¦