Warning: session_start(): open(/tmp/sess_74e89fad23cf2de0a8e39c7985693d2a, O_RDWR) failed: No space left on device (28) in /data/wiki/inc/init.php on line 239

Warning: session_start(): Failed to read session data: files (path: ) in /data/wiki/inc/init.php on line 239

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/auth.php on line 430
Writing /data/wiki/data/cache/d/de2edb2fcb553ea79b79c722a4e13dbc.captchaip failed

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/actions.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/lib/tpl/dokuwiki/main.php on line 12
2020-2021:teams:alchemist:2020_nowcoder_multiuniversity_4 [CVBB ACM Team]

用户工具

站点工具


2020-2021:teams:alchemist:2020_nowcoder_multiuniversity_4

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
2020-2021:teams:alchemist:2020_nowcoder_multiuniversity_4 [2020/07/22 16:52]
mountvoom [D. Dividing Strings]
2020-2021:teams:alchemist:2020_nowcoder_multiuniversity_4 [2020/07/24 11:23] (当前版本)
hardict [lpy]
行 11: 行 11:
  
 ===== lpy  ===== ===== lpy  =====
 +
 +比较函数必须得返回一个准确大小关系,如果关键字全相同可能会炸内存(递归栈)
 +
 +字符串方面还得加强
 ===== xsy  ===== ===== xsy  =====
  
行 71: 行 75:
 然后分类讨论: 然后分类讨论:
  
-$x -> x$,从$lcp+1$的位置开始判断,注意位数较少时的情况。+$x -> x$,从$lcp+1$的位置开始判断相邻只差是否$\leq 9$,注意位数较少时的情况。
  
 $x -> x + 1$,那么只能为$9999x$和$10000y$,且$x > y$。 $x -> x + 1$,那么只能为$9999x$和$10000y$,且$x > y$。
行 77: 行 81:
 $x -> x - 1, x > 1$,那么只能为$10000x$和$99999y$,且$x < y$。 $x -> x - 1, x > 1$,那么只能为$10000x$和$99999y$,且$x < y$。
  
-这三种情况显然不会同时出现,于是枚举开头一段的长度接下来暴力往后判断即可。+这三种情况当$x \ge 2$时不会同时满足,于是枚举开头一段的长度接下来暴力往后判断即可。
  
-需要注意$x = 1$时,需要先进行$x -> x + 1$的特判,因为两个相邻的个位数差一定$\leq 9$。+$x = 1$时,需要先进行$x -> x + 1$的特判,因为两个相邻的个位数差一定$\leq 9$。 
 + 
 +因为只能求出两个数的差值,所以可以维护一下每一段相对于第一段的差值,最后用最大差值减去最小差值即可
  
 by MountVoom by MountVoom
 +
 +===== H. Harder Gcd Problem =====
 +
 +据说是原题,​$1 \sim n$取二元组$(a,​b),​gcd(a,​b)>​1$,​使数量最多
 +
 +首先每个数只与有哪些素因子有关,用贪心的思想,易想到较大的素因子应该优先匹配,素因子越少的数优先匹配
 +
 +从后向前枚举每个素因子$p$,然后把$p|x$且没匹配的数放一起
 +
 +按素因子个数与从大到小第一个不同的素因子大小排序,然后贪心取即可
 +
 +by Hardict
 +
 ====== 补题 ====== ====== 补题 ======
2020-2021/teams/alchemist/2020_nowcoder_multiuniversity_4.1595407953.txt.gz · 最后更改: 2020/07/22 16:52 由 mountvoom