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

推荐订阅源

T
Threatpost
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
P
Proofpoint News Feed
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
C
Cisco Blogs
L
LangChain Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
量子位
AWS News Blog
AWS News Blog
爱范儿
爱范儿
Know Your Adversary
Know Your Adversary
F
Full Disclosure
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
S
Schneier on Security
Spread Privacy
Spread Privacy
P
Privacy International News Feed
人人都是产品经理
人人都是产品经理
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
Latest news
Latest news
D
Docker
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
The Register - Security
The Register - Security
T
Tailwind CSS Blog
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security Affairs
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Martin Fowler
Martin Fowler
I
InfoQ
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Tenable Blog

某岛

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 法术指南 卡农 Codeforces Round #819 瓦喵之夏 NOI 2022 Luogu P3765 总统选举 Luogu P3369 【模板】普通平衡树 网络国家 旋转卡壳 OFAC Sanctions && Tornado Cash BZOJ 1185. [HNOI2007]最小矩形覆盖 Codeforces Round #814
Educational Codeforces Round 135
2022-09-13 · via 某岛

Problem D. Letter Picking

区间博弈 dp,状态 f[][],但是比一般的博弈 dp 要简单,转移 trivial。
首先我们可以两轮操作绑定在一起转移,只要考虑长度为偶数的状态,并且也不用记录上一轮选了什么字符。
进一步不难归纳出结果只有可能是先手胜或平局,进一步简化状态和转移。

#include <lastweapon/io>
using namespace lastweapon;

const int N = int(2e3) + 9;
char s[N]; bool f[N][N];
int n;

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    Rush {
        n = strlen(RS(s));

        REP(i, n+1) f[i][i] = 0;

        for(int l=2;l<=n;l+=2) {
            REP(i, n-l+1) {
                int j = i+l;
                bool ll = f[i+2][j] || (s[i] > s[i+1]);
                bool lr = f[i+1][j-1] || (s[i] > s[j-1]);
                bool rl = f[i+1][j-1] || (s[j-1] > s[i]);
                bool rr = f[i][j-2] || (s[j-1] > s[j-2]);
                f[i][j] = (ll && lr) || (rl && rr);
            }
        }
        puts(f[0][n] ? "Alice" : "Draw");
    }
}

Problem E. Red-Black Pepper

调整法。先考虑判定性问题,用扩展欧几里得求丢番图方程 ax + by = n 特解,然后判断是否存在一组解使得 ax 在 [0, n] 范围内即可。

考虑最优化问题,根据输入,可以预处理出关于 ax 的,定义域为 [0, n] 之间整数的,非严格凸函数 f,所谓非严格就是可能中间存在一些相等的情况,比如最值可能会是一个区间,
不过稍后会看到,这问题并不大。。

每次询问的目标函数的定义域则是 f 函数的子集,以特解为中心,每次步长为 lcm(a, b),这也是非严格凸函数,因为我们已经预处理出了它的导数,所以可以在导数上二分求极值。
不过我们能做的更好,只要检查最值附近的两个点的函数式值 f(xl), f(xr) 即可,具体来说,假设我们预处理阶段保留的是最值的右端点 x0,
那么就检查 xl < x0 <= xr,如果是左端点,
就检查 xl <= x0 < xr。。。

#include <lastweapon/io>
using namespace lastweapon;

const int N = int(3e5) + 9;
int a[N], b[N], x0; LL f[N];
int n;

LL exgcd(LL a, LL b, LL &x, LL &y){
    if (!b){
        x = 1, y = 0;
        return a;
    }
    LL d = exgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

LL query() {
    LL a, b, x, y; RD(a, b);
    LL d = exgcd(a, b, x, y);
    if (n % d) return -1;
    x *= n/d*a; d = a/d*b;
    x -= ceil(max(0ll, x-x0), d) * d;
    x += max(0ll, x0-x) / d * d;
    LL z = -1; if (x >= 0) checkMax(z, f[x]);
    x += d; if (x <= n) checkMax(z, f[x]);
    return z;
}

void init() {
    RD(n); LL s = 0; REP(i, n) RD(a[i], b[i]), s += b[i];
    REP(i, n) a[i] -= b[i]; sort(a, a+n, greater<int>());
    f[0] = s; REP(i, n) f[i+1] = f[i] + a[i];
    x0 = upper_bound(a, a+n, 0, greater<int>()) - a - 1;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    init(); Rush OT(query());
}

Problem F. Fishermen

。。。居然比赛时只有 <10 个人过,,,但是做法非常简单。。。
首先可以看出是个最优匹配模型。。然后,权值都在单侧的顶点上,于是可以 sort 之后直接跑 Kuhn’s 算法。。。这是个比较常见的套路。。
然后再加一个优化。。。“if you haven’t found an augmenting path, don’t reset the values representing which vertices were visited by the algorithm.”
就过了。。。囧。。

#include <lastweapon/io>
using namespace lastweapon;

const int N = int(1e3) + 9, N2 = N*N;
int a[N], b[N2], py[N]; bool vis[N2]; VI adj[N2];
int n, bn;

bool dfs(int x) {
    if (vis[x]) return 0;
    vis[x] = 1;
    for (auto y: adj[x]) {
        int xx = py[y];
        if (xx == -1 || dfs(xx)) {
            py[y] = x;
            return 1;
        }
    }
    return 0;
}

LL kuhn() {
    LL z = 0; int c = 0;
    fill(py, py+n, -1);
    REP(i, bn) if (dfs(i)) {
        z += b[i]; fill(vis, vis+bn, 0);
        ++c; if (c == n) break;

    }
    return z;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif
    RD(n); REP(i, n) {
        RD(a[i]); REP(j, n) b[i*n+j] = a[i]*(j+1);
    }
    bn = n*n; sort(b, b+bn); bn = unique(b, b+bn) - b;

    REP(i, n) {
        int t = 0; REP(j, n) {
            t = lower_bound(b+t, b+bn, a[i]*(j+1)) - b;
            adj[t].PB(i);
        }
    }
    OT(kuhn());
}

Posted by xiaodao
Category: 日常