5.25 NOI 模拟
\(T1\)旅行计划
不\(sb\)的题
比较显然转化成求一个点到所有点的最短路和
考虑我们非树边很少,那么可以把非树边连接的点看做是关键点,那么我们可以预处理每个关键点之间的最短路
我们每次询问,对询问点看做关键点,我们的路径肯定是关键点之间路径\(+\)树上路径,我们对于每个关键点的管控范围可以求出,那么我们最后求的是,一个点到所有关键点的权值\(+\)每个关键点对应联通块的子树贡献,可以把每个联通快统一处理,每次跑一遍类似虚树的东西,然后建立虚树时候顺便统计子树贡献即可,本质上大概也是个类似换根\(dp\)的东西,在每个关键点往外扩张的过程
\(T2\)搬砖
\(sb\)题,上午把式子推对了硬是没看出差分
//考虑这个维护的是什么
//我们维护区间连续的一段取模同余的最大模数
//假设只有两个数,我们的数字是abs(x-y)[x!=y]
//对于一个序列.我们的数字是一段区间所有相邻的gcd
//在这里,我已经得到了正解,tmd这是差分??????
//我没意识到...
//那么就很简单了,我们线段树维护区间差分gcd
//我们第二个修改时区间加,那么只需要改变两个位置
//第一个操作是区间变化直接打一个区间标记即可
//k=2a,m=a^2+b 区间gcd为gcd(kl+m,k)
#include<bits/stdc++.h>
#define int __int128
#define MAXN 200005
using namespace std;
int h[MAXN],n,q;
__int128 gcd(__int128 a,__int128 b)
{
if(a==0) return b;
if(b==0) return a;
return gcd(b,a%b);
}
int Abs(int a)
{
if(a>0) return a;
return -a;
}
namespace Seg1
{
#define ls (now<<1)
#define rs ((now<<1)|1)
struct Tr
{
int l,r,add,lza,lzb,lzc;
__int128 num;
bool lz;
}tr[MAXN<<2];
void build(int now,int l,int r)
{
tr[now].l=l;
tr[now].r=r;
if(l==r)
{
tr[now].num=h[l];
return ;
}
int mid=(l+r)>>1;
build(ls,l,mid);
build(rs,mid+1,r);
}
void pd(int now)
{
if(tr[now].lz)
{
int a=tr[now].lza;
int b=tr[now].lzb;
int c=tr[now].lzc;
tr[ls].lza=a; tr[ls].lzb=b; tr[ls].lzc=c; tr[ls].lz=true; tr[ls].add=0;
tr[ls].num=tr[ls].l*tr[ls].l*a+tr[ls].l*b+c;
tr[rs].lza=a; tr[rs].lzb=b; tr[rs].lzc=c; tr[rs].lz=true; tr[rs].add=0;
tr[rs].num=tr[rs].l*tr[rs].l*a+tr[rs].l*b+c;
tr[now].lza=tr[now].lzb=tr[now].lzc=0;
tr[now].lz=false;
}
if(tr[now].add)
{
int add=tr[now].add;
tr[ls].num+=add;
tr[ls].add+=add;
tr[rs].num+=add;
tr[rs].add+=add;
tr[now].add=0;
}
}
void Cover(int now,int l,int r,int a,int b,int c)
{
pd(now);
if(tr[now].l>=l&&tr[now].r<=r)
{
tr[now].lz=true;
tr[now].lza=a;
tr[now].lzb=b;
tr[now].lzc=c;
tr[now].add=0;
tr[now].num=tr[now].l*tr[now].l*a+tr[now].l*b+c;
pd(now);
return ;
}
int mid=(tr[now].l+tr[now].r)>>1;
if(l<=mid) Cover(ls,l,r,a,b,c);
if(r>mid) Cover(rs,l,r,a,b,c);
}
void change(int now,int l,int r,int c)
{
pd(now);
if(tr[now].l>=l&&tr[now].r<=r)
{
tr[now].add+=c;
tr[now].num+=c;
pd(now);
return ;
}
int mid=(tr[now].l+tr[now].r)>>1;
if(l<=mid) change(ls,l,r,c);
if(r>mid) change(rs,l,r,c);
}
int query(int now,int poz)
{
pd(now);
if(tr[now].l==poz&&tr[now].r==poz)
{
return tr[now].num;
}
int mid=(tr[now].l+tr[now].r)>>1;
if(poz<=mid) return query(ls,poz);
else return query(rs,poz);
}
}
namespace Seg2
{
#define ls (now<<1)
#define rs ((now<<1)|1)
struct Tr
{
int l,r,lza,lzb,lzc;
__int128 G;
bool lz;
}tr[MAXN<<2];
int GCD(int l,int r,int a,int b,int c)
{
return __gcd(2*a,2*a*l-a+b);
}
int val(int p,int a,int b,int c)
{
return p*p*a+p*b+c;
}
void upd(int now)
{
tr[now].G=gcd(tr[ls].G,tr[rs].G);
}
void build(int now,int l,int r)
{
tr[now].l=l;
tr[now].r=r;
if(l==r)
{
tr[now].G=Abs(h[l]-h[l+1]);
return ;
}
int mid=(l+r)>>1;
build(ls,l,mid);
build(rs,mid+1,r);
upd(now);
}
void pd(int now)
{
if(tr[now].lz)
{
int a=tr[now].lza;
int b=tr[now].lzb;
int c=tr[now].lzc;
int k=2*a;
int m=a*a+b;
tr[ls].lza=a; tr[ls].lzb=b; tr[ls].lzc=c; tr[ls].lz=true;
if(tr[ls].l!=tr[ls].r)tr[ls].G=GCD(tr[ls].l,tr[ls].r,a,b,c);
else tr[ls].G=Abs(val(tr[ls].l+1,a,b,c)-val(tr[ls].l,a,b,c));
tr[rs].lza=a; tr[rs].lzb=b; tr[rs].lzc=c; tr[rs].lz=true;
if(tr[rs].l!=tr[rs].r)tr[rs].G=GCD(tr[rs].l,tr[rs].r,a,b,c);
else tr[rs].G=Abs(val(tr[rs].l+1,a,b,c)-val(tr[rs].l,a,b,c));
tr[now].lz=false;
tr[now].lza=0; tr[now].lzb=0; tr[now].lzc=0;
}
}
/*
*/
void Cover(int now,int l,int r,int a,int b,int c)
{
// cout<<"Tr: "<<(long long)tr[now].l<<" "<<(long long)tr[now].r<<"\n";
if(tr[now].l>=l&&tr[now].r<=r)
{
// cout<<tr[now].l<<" tott "<<tr[now].r<<" "<<endl;
int k=2*a;
int m=a*a+b;
if(tr[now].l==tr[now].r)
{
tr[now].G=Abs(val(tr[now].r+1,a,b,c)-val(tr[now].l,a,b,c));
// cout<<"change "<<" "<<(long long)now<<" "<<(long long)tr[now].l+1<<" "<<(long long)tr[now].r+1<<" "<<(long long)tr[now].G<<endl;
// cout<<a<<" "<<b<<" "<<c<<endl;
// cout<<"kok: "<<tr[now].l<<" "<<tr[now].r<<"\n";
return ;
}
tr[now].lz=true;
tr[now].lza=a;
tr[now].lzb=b;
tr[now].lzc=c;
tr[now].G=GCD(tr[now].l,tr[now].r,a,b,c);
// cout<<"here "<<tr[now].l<<" "<<tr[now].r<<" "<<(long long )tr[now].G<<endl;
return ;
}
pd(now);
int mid=(tr[now].l+tr[now].r)>>1;
if(l<=mid) Cover(ls,l,r,a,b,c);
if(r>mid) Cover(rs,l,r,a,b,c);
upd(now);
}
void change(int now,int poz,int k)
{
if(tr[now].l==poz&&tr[now].r==poz)
{
tr[now].G=k;
return ;
}
pd(now);
int mid=(tr[now].l+tr[now].r)>>1;
if(poz<=mid) change(ls,poz,k);
else change(rs,poz,k);
upd(now);
}
void debug(int now)
{
pd(now);
cout<<(long long)now<<" "<<(long long)tr[now].l<<" "<<(long long)tr[now].r<<" "<<((long long)tr[now].G)<<"\n";
if(tr[now].l!=tr[now].r)debug(ls),debug(rs);
}
}
void print(__int128 x)
{
int cnt=0;
signed Mid[100];
if(x==0)
{
cout<<0<<"\n";
return;
}
while(x)
{
Mid[++cnt]=x%10;
x/=10;
}
for(int i=cnt;i>=1;i--) cout<<Mid[i];
cout<<"\n";
}
int Read()
{
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-') f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
return x;
}
signed main()
{
n=Read(),q=Read();
// scanf("%lld%lld",&n,&q);
for(int i=1;i<=n;i++)
{
h[i]=Read();
// scanf("%lld",&h[i]);
}
Seg1::build(1,1,n);
Seg2::build(1,1,n-1);
for(long long i=1,op,l,r,a,b,c;i<=q;i++)
{
// cin>>op>>l>>r>>a>>b>>c;
op=Read(),l=Read(),r=Read(),a=Read(),b=Read(),c=Read();
// scanf("%lld%lld%lld%lld%lld%lld",&op,&l,&r,&a,&b,&c);
if(op==1)
{
Seg1::Cover(1,l,r,a,b,c);
// if(l-1)
if(r!=1) Seg2::Cover(1,l,max(r-1,1ll),a,b,c);
int res1,res2;
if(l-1>=1)
{
res1=Seg1::query(1,l-1);
res2=Seg1::query(1,l);
Seg2::change(1,l-1,Abs(res1-res2));
}
if(r+1<=n)
{
res1=Seg1::query(1,r);
res2=Seg1::query(1,r+1);
Seg2::change(1,r,Abs(res1-res2));
}
}
if(op==2)
{
Seg1::change(1,l,r,c);
int res1,res2;
if(l-1>=1)
{
res1=Seg1::query(1,l-1);
res2=Seg1::query(1,l);
Seg2::change(1,l-1,Abs(res1-res2));
}
if(r+1<=n)
{
res1=Seg1::query(1,r);
res2=Seg1::query(1,r+1);
Seg2::change(1,r,Abs(res1-res2));
}
}
print(Seg2::tr[1].G);
}
}
\(T3\)寻觅
\(sb\)题,暴力能水过去
//说句人话就是
//一个区间除了都是零否则至少有一个数只出现一次
//考虑最后的序列至少有一个数只能出现一次
//那么填满之后的序列必须有一个数出现一次
//贪心维护?
//反正最终序列必须有一个出现一次,不妨设第一个是1
//我们肯定是按顺序插入?
//或者是每一段区间至少被覆盖一次
//一段区间要不被左端点覆盖,要不被右端点覆盖,要不被中间点覆盖(废话)
//直接构造就行吧,为什么要有顺序?这样貌似限制更强
//那考虑顺序,我们要保证每时每刻都要被覆盖
//那么我们新增一个点
//那么我们和他相等的点的覆盖范围就要被截断
//我们要实时保证有的地方可以被覆盖
//而且0的位置可以忽略
//我们维护一个每个数字维护一个set
//然后实时更新覆盖范围,最多n^2个我们每次至多n^2,n^3上限达不到
//乘个24的小常数
//盲猜正解直接转化成二维区间加减了,询问区间和是否等于0
#include<bits/stdc++.h>
#define MAXN 8505
using namespace std;
int cov[MAXN][MAXN],Fin[MAXN],p[MAXN],T;
set<int>Num[25];
void solve(int poz)
{
for(int i=1;i<=24;i++)
{
int l=*(--lower_bound(Num[i].begin(),Num[i].end(),poz));
int r=(*upper_bound(Num[i].begin(),Num[i].end(),poz));
int ll=*(--lower_bound(Num[i].begin(),Num[i].end(),l));
int rr=*(upper_bound(Num[i].begin(),Num[i].end(),r));
bool flag=true;
for(int j=l;j>ll;j--)
{
for(int k=poz;k<r;k++)
{
if(cov[j][k]<=1)
{
flag=false;
goto EB;
}
}
}
for(int j=poz;j>l;j--)
{
for(int k=r;k<rr;k++)
{
if(cov[j][k]<=1)
{
flag=false;
goto EB;
}
}
}
EB:
if(flag)
{
Fin[poz]=i;
Num[i].insert(poz);
for(int j=l;j>ll;j--)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4,1,2,5,1,2,13,1,2};
void sub2()
{
for(int i=1;i<=n;i++)
{
cout<<A[i]<<" ";
}
cout<<"\n";
}
void sol()
{
scanf("%d",&n);
memset(cov,0,sizeof(cov));
for(int i=1;i<=24;i++)
{
while(Num[i].size()) Num[i].erase(Num[i].begin());
Num[i].insert(0);
Num[i].insert(n+1);
}
bool flag=true;
for(int i=1;i<=n;i++)
{
scanf("%d",&p[i]);
if(p[i]!=i) flag=false;
}
if(flag)
{
sub2();
return ;
}
for(int i=1;i<=n;i++)
{
solve(p[i]);
}
for(int i=1;i<=n;i++)
{
cout<<Fin[i]<<" ";
}
cout<<"\n";
}
int main()
{
scanf("%d",&T);
while(T--) sol();
}
5.25 NOI 模拟的更多相关文章
- 5.30 NOI 模拟
$5.30\ NOI $模拟 高三大哥最后一次模拟考了,祝他们好运 \(T1\)装箱游戏 显然可以将四种字母之间的空缺当做状态枚举 那么这道题就很显然了 #include<bits/stdc++ ...
- 5.23 NOI 模拟
$5.23\ NOI $模拟 \(T1\)简单的计算几何题 \(zjr:\)我当时没改,那么自己看题解吧 倒是有个简单的随机化方法(能获得\(72pts,\)正确性未知)\(:\) 随机两条切椭圆的平 ...
- 5.6 NOI模拟
\(5.6\ NOI\)模拟 明天就母亲节了,给家里打了个电话(\(lj\ hsez\)断我电话的电,在宿舍打不了,只能用教练手机打了) 其实我不是很能看到自己的\(future,\)甚至看不到高三的 ...
- 5.4 NOI模拟
\(5.4\ NOI\)模拟 \(T1\) 想到分讨,但是暴力输出一下方案之后有很多特别的情况要讨论,就弃了... 假设\(a\)是原序列,\(b\)是我们得到的序列 设\(i\)是最长公共前缀,\( ...
- NOI模拟赛 Day1
[考完试不想说话系列] 他们都会做呢QAQ 我毛线也不会呢QAQ 悲伤ING 考试问题: 1.感觉不是很清醒,有点困╯﹏╰ 2.为啥总不按照计划来!!! 3.脑洞在哪里 4.把模拟赛当作真正的比赛,紧 ...
- PAT 1002. A+B for Polynomials (25) 简单模拟
1002. A+B for Polynomials (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue T ...
- PAT甲题题解-1109. Group Photo (25)-(模拟拍照排队)
题意:n个人,要拍成k行排队,每行 n/k人,多余的都在最后一排. 从第一排到最后一排个子是逐渐增高的,即后一排最低的个子要>=前一排的所有人 每排排列规则如下: 1.中间m/2+1为该排最高: ...
- NOI 模拟赛 #2
得分非常惨惨,半个小时写的纯暴力 70 分竟然拿了 rank 1... 如果 OYJason 和 wxjor 在可能会被爆踩吧 嘤 T1 欧拉子图 给一个无向图,如果一个边集的导出子图是一个欧拉回路, ...
- 【2018.12.10】NOI模拟赛3
题目 WZJ题解 大概就是全场就我写不过 $FFT$ 系列吧……自闭 T1 奶一口,下次再写不出这种 $NTT$ 裸题题目我就艹了自己 -_-||| 而且这跟我口胡的自创模拟题 $set1$ 的 $T ...
随机推荐
- 做一个能对标阿里云的前端APM工具(下)
上篇请访问这里做一个能对标阿里云的前端APM工具(上) 样本多样性问题 上一小节中的实施方案是微观的,即单次性的.具体的.但是从宏观上看,我需要保证性能测试是公允的,符合大众预期的.为了达到这种效果, ...
- 05-STL
Day01 笔记 1 STL概论 1.1 STL六大组件 1.1.1 容器.算法.迭代器.仿函数.适配器.空间配置器 1.2 STL优点 1.2.1 内建在C++编译器中,不需要安装额外内容 1.2. ...
- .Net分表分库动态化处理
介绍 本期主角:ShardingCore 一款ef-core下高性能.轻量级针对分表分库读写分离的解决方案,具有零依赖.零学习成本.零业务代码入侵 背景 最近有个小伙伴来问我,分表下他有一批数据,这个 ...
- Java_break和continue
目录 Java_break Java_continue goto关键字 视频 Java_break break在任何循环语句的主题部分, 均可以用break强行退出循环, 不执行循环中的剩余语句 br ...
- Dubbo3 源码系列 Dubbo“纠葛”(入门篇)
日期 更新说明 2022年5月28日 spring xml部分解读 2022年6月3日 spring annotation部分解读 人生不相见, 动如参与商. 今夕复何夕, 共此灯烛光. 少壮能几时, ...
- React简单教程-3.1-样式之使用 tailwindcss
前言 本文是作为一个额外内容,主要介绍 tailwindcss 的用法 tailwindcss 是一个功能类优先的 CSS 框架,我在以前的文章里有描述为什么使用功能类优先:为什么我在 css 里使用 ...
- MySQL - 锁的分类
MySQL - 锁的分类 1. 加锁机制 乐观锁 悲观锁 2. 兼容性 共享锁 排他锁 3. 锁粒度 表锁 页锁 行锁 4. 锁模式 记录锁(record-lock) 间隙锁(gap-lock) ne ...
- html关键字大全
html标签属性大全 html标签属性大全从网上搜集整理的常用html标签,供朋友们交流学习html用. html标签<marquee> <marquee>...</ma ...
- SAP Using Text Modules in Adobe Forms
In this demo we will create an adobe form which displays text in two different languages (English or ...
- JAVA设计模式总结—建造者模式
建造者模式 模式动机与定义 首先建造者模式的动机是为了创建复杂对象,简化传统的创建方法,提高创建的效率和可读性. 像图中的这个例子,用户的需求是驾驶一辆汽车,但是对于用户来说是不需要了解汽车装 ...