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

推荐订阅源

博客园_首页
阮一峰的网络日志
阮一峰的网络日志
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Threat Research - Cisco Blogs
P
Privacy & Cybersecurity Law Blog
The Hacker News
The Hacker News
H
Heimdal Security Blog
W
WeLiveSecurity
L
LINUX DO - 热门话题
Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
The Last Watchdog
The Last Watchdog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
D
DataBreaches.Net
I
Intezer
Webroot Blog
Webroot Blog
C
Cisco Blogs
AWS News Blog
AWS News Blog
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
罗磊的独立博客
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
Schneier on Security
Schneier on Security
宝玉的分享
宝玉的分享
博客园 - 叶小钗
PCI Perspectives
PCI Perspectives
D
Docker
Scott Helme
Scott Helme
NISL@THU
NISL@THU
J
Java Code Geeks
B
Blog RSS Feed
Google Online Security Blog
Google Online Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Exploit Database - CXSecurity.com
AI
AI
美团技术团队
Cloudbric
Cloudbric
月光博客
月光博客
P
Proofpoint News Feed
T
Tailwind CSS Blog
Google DeepMind News
Google DeepMind News
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
The Cloudflare Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

某岛

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]最小矩形覆盖
UOJ #77. A+B Problem
2022-07-14 · via 某岛

首先还是类似 POJ 3469. Dual Core CPU 的最小割建模。
难点是对每个节点 i,我们需要构造辅助节点 i’,满足,如果存在满足条件的 j 在 T 割,那么 i’ 也一定在 T 割。

因为找 j 的过程是一个区间关系,暴力构造 i’ 的话边数太多。
类比确定染色方案后,查询结果这个问题,这个显然可以离散化 + 线段树(树状数组),
我们发现可以使用线段树来刻画这些辅助节点以减少边的规模。(类似边分治里的加辅助结点?)
(3b1b 演示的话。。大概就是把 i’ 这个辅助点,慢慢扩散成一个线段树,每扩散一层,叶子所连的边的规模就少一层。。)。

这种题目的出法后来在网赛里也出过。。。
另外这个题要考虑 j <= i 这个限制,最后还需要使用函数式线段树。

const int N = int(5e3) + 9;

int T[N], X[N], Y[N]; vector<int> A;
int n, z;

namespace ST{

#define lx l[x]
#define rx r[x]
#define ly l[y]
#define ry r[y]
#define ml (ll + rr >> 1)
#define mr (ml + 1)

    const int NN = N*18 + 9;
    int l[NN], r[NN], tot;

    int new_node(){
        return ++tot;
    }

    int Add(int y, int p, int i){
        int x = new_node(), root = x; int ll = 0, rr = n-1;

        while (ll < rr){
            if (p < mr){
                lx = new_node(), rx = ry;
                x = lx, y = ly, rr = ml;
            }
            else {
                lx = ly, rx = new_node();
                x = rx, y = ry, ll = mr;
            }
        }

        X[i] = x; Y[i] = y;
        return root;
    }

    void Query(int x, int ll, int rr, int a, int b, VI& L) {
        if (!x || b < ll || rr < a) return;
        if (a <= ll && rr <= b) {
            L.PB(x);
        } else {
            Query(lx, ll, ml, a, b, L);
            Query(rx, mr, rr, a, b, L);
        }
    }
} using namespace ST;

struct cell{
    int a,b,w,l,r,p;
    void in() {
        RD(a,b,w,l,r,p); A.PB(a);
        z += b; z += w;
    }
} C[N];

int main(){

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("/Users/minakokojima/Documents/GitHub/ACM-Training/Workspace/out.txt", "w", stdout);
#endif

    RD(n); REP(i, n) C[i].in();

    UNQ(A); REP(i, n) {
        C[i].l = LBD(A, C[i].l); C[i].r = UBD(A, C[i].r)-1;
        T[i] = ST::Add(i ? T[i-1] : 0, C[i].a = LBD(A, C[i].a), i);
    }

    atcoder::mf_graph<int> G(n+n+2+ST::tot);
    int s = 2*n, t = n+n+1;

    FOR(x, 1, ST::tot) {
        if (lx) G.add_edge(t+x, t+lx, INF);
        if (rx) G.add_edge(t+x, t+rx, INF);
    }

    REP(i, n) {
        G.add_edge(s, i, C[i].b);
        G.add_edge(i, t, C[i].w);
        G.add_edge(i, n+i, C[i].p);
        /*REP(j, i) if (C[i].l <= C[j].a && C[j].a <= C[i].r) {
            G.add_edge(i+n, j, INF);
        }*/
        G.add_edge(t+X[i], i, INF); if (Y[i]) G.add_edge(t+X[i], t+Y[i], INF);
        VI L; ST::Query(T[i], 0, n-1, C[i].l, C[i].r, L);
        for (auto l: L) G.add_edge(n+i, t+l, INF);
    }

    cout << z - G.flow(s, t) << endl;
}

Posted by xiaodao
Category: 日常