惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
O
OpenAI News
Jina AI
Jina AI
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
WordPress大学
WordPress大学
F
Full Disclosure
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
www.infosecurity-magazine.com
www.infosecurity-magazine.com
SecWiki News
SecWiki News
F
Fortinet All Blogs
C
Check Point Blog
H
Hacker News: Front Page
H
Help Net Security
G
Google Developers Blog
The Cloudflare Blog
Google Online Security Blog
Google Online Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
S
Secure Thoughts
U
Unit 42
L
LINUX DO - 最新话题
博客园 - 【当耐特】
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
TaoSecurity Blog
TaoSecurity Blog
Recorded Future
Recorded Future
Apple Machine Learning Research
Apple Machine Learning Research
AI
AI
aimingoo的专栏
aimingoo的专栏
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Heimdal Security Blog
Y
Y Combinator Blog
月光博客
月光博客
Hacker News: Ask HN
Hacker News: Ask HN
D
DataBreaches.Net
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Schneier on Security
Schneier on Security
Cisco Talos Blog
Cisco Talos Blog
Last Week in AI
Last Week in AI

某岛

AtCoder Beginner Contest 409 Luogu P5325. 【模板】Min_25 筛 UOJ #188. 【UR #13】Sanrd AtCoder Beginner Contest 371 AtCoder Beginner Contest 369 RPGMaker 2k3 百科 OneShot 的考古 2024“开创拓芯”游戏创享节的相关记录 CJ 回来后的戒断反应 Luogu P10221. [省选联考 2024] 重塑时光 Luogu P5308 [COCI2018-2019#4] Akvizna wqs 二分 歌唱王国 Lean 相关 BZOJ 3153. Sone1 The 2023 ICPC World Finals Luxor 新巴别塔 Sora 的想象与思考 Facebook Hacker Cup 2023 Round 1 AtCoder Beginner Contest 322 LLaMA 2 相关 HuggingFace AI Game Jam ACL 2023 Trans 相关… Luogu P2053. [SCOI2007] 修车 Luogu P1973. [NOI2011] NOI 嘉年华 Luogu P1933. [NOI2010] 旅行路线 Luogu P1954. [NOI2010] 航空管制 Luogu P2048. [NOI2010] 超级钢琴 Luogu P2046. [NOI2010] 海拔 Luogu P3227. [HNOI2013] 切糕 Luogu P8500. [NOI2022] 冒泡排序 Luogu P3629. [APIO2010] 巡逻 USACO 2018 February Contest, Gold Problem 2. Directory Traversal Luogu P3647. [APIO2014] 连珠线 IZhO 2017. Problem F. Hard route SPOJ TWOPATHS. Two Paths 换根 dp 洪恩电脑 —— 开天辟地 Facebook Hacker Cup 2022 Round 2 Codeforces Round #875 Luogu P5828 边双连通图计数 EC Final 拉格朗日反演定理 Luogu P5827. 点双连通图计数 无标号连通图 AtCoder Beginner Contest 284 Luogu P4708. 画画 Luogu P6295. 有标号 DAG 计数 BZOJ #2863. 愤怒的元首 HDU 3303. Harmony Forever 聊聊《明日方舟 Side Story 孤星》与《崩坏:星穹铁道》 SGU 208. Toral Tickets 后日谈,SHLUG 月度分享(上) 钢琴练习 EasyRPG x ChatGPT ControlNet 相关 The 1st Universal Cup, Stage 4, Ukraine EasyRPG —— Sliding Puzzle The 1st Universal Cup, Stage 3, Poland DP 优化练习 NOI 2009 TypeDB Forces 2023 Nas 买来做什么… Global Game Jam 2023 参赛纪录 The 1st Universal Cup, Stage 2, Hongkong The 1st Universal Cup, Stage 0, Nanjing Codeforces Round #850 舟游同人游戏 RM2k3 机能增强 —— EasyRPG Player 魔改版 《海之歌》设定与剧本 dfs 序求 lca Codeforces Round #844 P3768 简单的数学题 AtCoder Beginner Contest 281 ChatGPT 相关 AtCoder Grand Contest 059 AtCoder Beginner Contest 280 Codeforces Global Round 24 事实核查,以乌鲁木齐火灾为例 SPOJ MUSKET. Musketeers Pinely Round 1 Note about FTX Permutation ICPC World Final 2021 CodeTON Round 3 Codeforces Round #831 Educational Codeforces Round 138 NovelAI 法术指南 卡农 Educational Codeforces Round 135 Codeforces Round #819 瓦喵之夏 NOI 2022 Luogu P3765 总统选举 Luogu P3369 【模板】普通平衡树 网络国家 旋转卡壳 OFAC Sanctions && Tornado Cash BZOJ 1185. [HNOI2007]最小矩形覆盖
Codeforces Round #814
2022-08-17 · via 某岛

传送门

感觉掉了近 100 分。QAQ。。
题目还是非常不错的。。。特别是 D 题~~

比赛时先开了 A2 但是写得非常有问题。。然后就只能先去写 A1 拿分。。。结果 A1 还写错了 1 次,并且 A2 就一直没 debug。。。
然后开 B 给的贪心也很失败。。需要特判很多情况。。。最后虽然发现了错误的 case。。。但是最后 debug 的时候居然写错了。。导致一直以为是 case 没找对。。。

Problem A. Burenka and Traditions

题意:有一个数组a,每次可以选择一个区间 [l,r] 和一个整数 x,将 al, al+1, …, ar 中与 x 异或,代价为 \ceil((r-l+1)/2)
问至少需要多少代价,数组所有元素均变为 0。

A1, n, ai <= 5000.
A2, n <= 1e5, ai <= 1e9,

。。最好就不要看 A1。。。(A1 dp 写完浪费时间不说,还容易数组开小导致写错。。)
首先选长度 >= 2 的区间是没有意义的,我们只需要用一些长度为 1、2 的区间拼成连续的操作序列即可。。
考察下面的情况。。。
3
1 2 3
显然,操作序列应该是。。。
1 2 3 -> 0 3 3 -> 0 0 0
也就是我们要找到前缀的 xor 等于当前数的情况。
这个只需要用一个 set 维护,发现出现重复数字就说明出现了一种上述的情况,此时可以答案 -1,并把当前 set 清空。

Problem B. Fibonacci Strings

我肯定是很久很久以前在 cf 做过类似的题,(好像也是 B。。。)
那么既然可以唯一斐波那契分解,所以理论上就可以随便做了。
有问题的是这个题有两个 1,可能会有冲突,可以枚举这多出的 1 分给哪,然后继续硬做。。
但是这样非常不优雅,好的贪心设计是不需要特判的。

Problem C. Tonya and Burenka-179

先不考虑修改。
那么我们首先考虑 n 是素数的情况,那么显然无论 (s,k) 怎么选,f(s, k) 都是一样的,序列的和。
当 n 不是素数的时候,就会根据每个 n 的因子 d,分成一些长度为 n/d, 间隔为 d,每个位置根据 %d 的结果进行分类,每类求和并乘以 d 就是 f(s, k) 的值。
那么一个重要的结论就是对于 d1 | d2,我们只需要考察 d1 即可,因为 d1 所张成的集合是 d2 的真子集,且一定存在一个均值更高的子集,其所对应的 f(s, k) 的值也更高。

因此只需要因子分解 n,预处理出所有不同的 f(s, k) 即可。。。
最后考虑修改,显然需要搞个数据结构维护最值。。。
这里只有单点修改,所以开两个堆维护即可。

#include<lastweapon/io>
using namespace lastweapon;

const int PMAX = 31623;
VI P; bitset<PMAX> isC;
#define ii (i*P[j])
void sieve(){
    FOR(i, 2, PMAX){
        if (!isC[i]) P.PB(i);
        for (int j=0;j<SZ(P)&&ii<PMAX;++j){
            isC[ii]=1; if (!(i%P[j])) break;
        }
    }
}
#undef ii

const int N = int(2e5) + 9;
int a[N], n, q;

void solve() {
    RD(n, q); REP(i, n) RD(a[i]);

    VI fac; int x = n; REP(i, SZ(P)) {
        int p = P[i]; if (p*p > x) break;
        if (x % p) continue;
        x /= p; while (x % p == 0) x /= p;
        fac.PB(n/p);
    }
    if (x != 1) fac.PB(n/x);

    vector<vector<LL>> s(SZ(fac));
    priority_queue<LL> Q, D;

    REP(i, SZ(fac)) {
        int p = fac[i]; s[i].resize(p);
        REP(j, n) s[i][j%p] += a[j];
        REP(j, p) Q.push(s[i][j] * p);
    }

    auto modify = [&](int x, int d) {
        REP(i, SZ(fac)) {
            int p = fac[i], j = x % p;
            D.push(s[i][j] * p); s[i][j] += d;
            Q.push(s[i][j] * p);
        }
        while (!D.empty() && D.top() == Q.top()) {
            D.pop(), Q.pop();
        }
    };

    printf("%lld\n", Q.top()); DO(q) {
        int p, v; RD(p, v); --p;
        modify(p, v-a[p]); a[p] = v;
        printf("%lld\n", Q.top());
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif
    sieve(); Rush solve();
}

Problem D. …

Posted by xiaodao
Category: 日常