#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int a[200007],b[200007],c[200007];
int cnt1[200007],cnt2[200007],cnt3[200007];
int mn[200007];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int k1,k2,k3;
cin>>k1>>k2>>k3;
for(int i=1;i<=k1;++i){
cin>>a[i];
++cnt1[a[i]];
}
for(int i=1;i<=k2;++i){
cin>>b[i];
++cnt2[b[i]];
}
for(int i=1;i<=k3;++i){
cin>>c[i];
++cnt3[c[i]];
}
int n=k1+k2+k3;
for(int i=1;i<=n;++i){
cnt1[i]=cnt1[i-1]+cnt1[i];//小于等于i的个数
cnt2[i]=cnt2[i-1]+cnt2[i];
cnt3[i]=cnt3[i-1]+cnt3[i];
}
for(int i=0;i<=n;++i)
mn[i]=cnt3[i]-cnt2[i];
for(int i=n-1;i>=0;--i)
mn[i]=min(mn[i+1],mn[i]);
int ans=1e9;
for(int i=0;i<=n;++i)
ans=min(ans,cnt2[i]-cnt1[i]+mn[i]+cnt1[n]+cnt2[n]);
/*
假设最终状态为第一个人有0~i,第二个人有i+1~j,第三个人有j+1~n
那么最小操作数等于第二个人和第三个人拥有的1~i个数加上第一个人和第三个人拥有的i+1~j个数加上第一个人和第二个人拥有的j+1~n个数
即cnt2[i]+cnt3[i]+cnt1[j]-cnt1[i]+cnt3[j]-cnt3[i]+cnt1[n]-cnt1[j]+cnt2[n]-cnt2[j]
化简为cnt2[i]-cnt1[i]+cnt3[j]-cnt2[j]+cnt1[n]+cnt2[n]
从0到n枚举i,只剩下cnt3[j]-cnt2[j]一个变量
维护一个后缀数组mn[i]表示[i,n]中最小的cnt3[j]-cnt2[j]
*/
cout<<ans;
return 0;
}

Educational Codeforces Round 76 (Rated for Div. 2)E(最长上升子序列)的更多相关文章

  1. Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest

    Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest(dp+线段树) 题目链接 题意: 给定3个人互不相同的多个数字,可以 ...

  2. Educational Codeforces Round 76 (Rated for Div. 2)E(dp||贪心||题解写法)

    题:https://codeforces.com/contest/1257/problem/E 题意:给定3个数组,可行操作:每个数都可以跳到另外俩个数组中去,实行多步操作后使三个数组拼接起来形成升序 ...

  3. Educational Codeforces Round 76 (Rated for Div. 2)

    传送门 A. Two Rival Students 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/13 22:37:26 */ #incl ...

  4. Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest dp

    E. The Contest A team of three programmers is going to play a contest. The contest consists of

  5. Educational Codeforces Round 76 (Rated for Div. 2) D. Yet Another Monster Killing Problem 贪心

    D. Yet Another Monster Killing Problem You play a computer game. In this game, you lead a party of

  6. Educational Codeforces Round 76 (Rated for Div. 2) C. Dominated Subarray 水题

    C. Dominated Subarray Let's call an array

  7. Educational Codeforces Round 76 (Rated for Div. 2) B. Magic Stick 水题

    B. Magic Stick Recently Petya walked in the forest and found a magic stick. Since Petya really likes ...

  8. Educational Codeforces Round 76 (Rated for Div. 2) A. Two Rival Students 水题

    A. Two Rival Students There are

  9. Educational Codeforces Round 76 (Rated for Div. 2) D题

    题意: 给你n个关卡,每个关卡有一个怪物,怪物的攻击力为a[i],你有n个英雄,每个英雄有一个攻击力,和疲劳值,只要英雄的攻击力比怪物的高就算打过了,同时疲劳减一,一天只能出战一个英雄,一个英雄可以打 ...

  10. Educational Codeforces Round 76 (Rated for Div. 2) D

    D题 原题链接 题意:就是给你n个怪兽有一个属性(攻击力),m个英雄,每个英雄有两种属性(分别为攻击力,和可攻击次数),当安排最好的情况下,最少的天数(每选择一个英雄出战就是一天) 思路:因为怪兽是不 ...

随机推荐

  1. TD - 单选框 - RadioButton

    基本方法 Html - 默认选中 //checked="true" - 默认选中 <input dojoType="bootstrap.form.RadioButt ...

  2. 第三篇,ajax 和 axios、fetch的区别

    1.jQuery ajax $.ajax({ type: 'POST', url: url, data: data, dataType: dataType, success: function () ...

  3. js基础之--变量 作用域和内存问题

    基本类型:Undefind Null Boolean Number String 引用类型: 对象 在操作对象时,实际上实在操作对象的引用而不是实际的对象.为此,引用类型的值是按引用访问的. 从一个变 ...

  4. 慎用--skip-grant-tables命令

    该命令作用是跳过授权表,也就是说谁都能进入mysql看到所有数据表,输入任意字符账号密码都可以 当忘记账号密码时可以使用改命令修改密码,但是要随用随关,重启mysql,不然服务器上会有很大的风险. 介 ...

  5. 什么是nuget?nuget包是如何管理

    本文链接:https://blog.csdn.net/Microsoft_Mao/article/details/101159800做windows开发的,迟早会接触到nuget这个东西,那么今天我们 ...

  6. logits的用法和此类标注的作用,已经再最后一层加了映射了就不需要再加入了

    logits的用法和此类标注的作用,已经再最后一层加了映射了就不需要再加入了 待办 PyTorch(tensorflow类似)的损失函数中,有一个(类)损失函数名字中带了with_logits. 而这 ...

  7. 常见运算符_python

    一.算数运算符a=2b=5c=8#加减乘除print(a+b,a-b,a*b,a/b)#取模,也就是余数print(b%a)#取整除print(b//a)#幂(次方)print(b**a) 二.比较运 ...

  8. NOIP做题练习(day1)

    A - Xenny and Alternating Tasks 题面 题解 枚举第一天是谁做,将两个答案取\(min\)即可. 代码 #include <iostream> #includ ...

  9. 最小树形图模板 UVA11183

    题意:给定n个节点m条边的有向带权图,求以0为根节点的最小树形图权值大小 用这个代码的时候要注意,这里的数据是从0开始的,边也是从0开始算, 所以在打主代码的时候,如果是从1开始,那么算法里面的从0开 ...

  10. [蓝桥杯][基础训练]FJ的字符串

    Description FJ在沙盘上写了这样一些字符串: A1 = “A” A2 = “ABA” A3 = “ABACABA” A4 = “ABACABADABACABA” … … 你能找出其中的规律 ...