当前位置: 首页 > news >正文

更改网站文章上传时间win7优化教程

更改网站文章上传时间,win7优化教程,沧县做网站,富阳网站定制开发哪家公司好题目 t(t<1e5)组样例&#xff0c;每次给出a,b,c,d,m(0<a,b,c,d,m<2的30次方) 初始时&#xff0c;(x,y)(a,b)&#xff0c;每次操作&#xff0c;你可以执行以下四种操作之一 ①xx&y&#xff0c;&为与 ②xx|y&#xff0c;|为或 ③yx^y&#xff0c;^为异或 …

题目

t(t<=1e5)组样例,每次给出a,b,c,d,m(0<=a,b,c,d,m<2的30次方)

初始时,(x,y)=(a,b),每次操作,你可以执行以下四种操作之一

①x=x&y,&为与

②x=x|y,|为或

③y=x^y,^为异或

④y=y^m,^为异或

求将(x,y)=(c,d)的最小操作数,如果无法实现,输出-1

思路来源

乱搞AC & tanao学弟

题解

按位考虑每一位时,有如下转移图,

注意到,将m也考虑进去,会构成一个三元组,只有(0,0,0)到(1,1,1)八种可能

30位里只有这8种可能,由于每次操作相同的可能的转移是一样的,

所以,如果相同的(x>>i&1,y>>i&1,w>>&1)对应的(c>>i&1,d>>i&1)不同时,直接无解

然后,可以只留8位,将8位标号id=0-7

每个标号id都有出现和没出现两种情况,一共2的8次方,256种情况

所以,可以对于第i(0<=i<256)情况预处理,

初始的(a,b)和i是对应的,转化的(c,d)也都在[0,256)之间

最多有256种情况*256*256种(c,d)值,每次转移有四种情况

预处理之后,对于1e5组询问,O(1)回答即可

代码中用的是数组记忆化,和预处理的效果是等价的

复杂度O(256*256*256*4+1e5)

代码

#include<bits/stdc++.h>
// #include<iostream>
// #include<vector>
// #include<queue>
// #include<map>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
typedef long long ll;
typedef double db;
typedef pair<int,int> P;
#define fi first
#define se second
#define dbg(x) cerr<<(#x)<<":"<<x<<" ";
#define dbg2(x) cerr<<(#x)<<":"<<x<<endl;
#define SZ(a) (int)(a.size())
#define sci(a) scanf("%d",&(a))
#define pb push_back
#define pt(a) printf("%d",a);
#define pte(a) printf("%d\n",a)
#define ptlle(a) printf("%lld\n",a)
#define debug(...) fprintf(stderr, __VA_ARGS__)
//std::mt19937_64 gen(std::chrono::system_clock::now().time_since_epoch().count());
//ll get(ll l, ll r) { std::uniform_int_distribution<ll> dist(l, r); return dist(gen); }
const int N=1e5+10,M=256,INF=0x3f3f3f3f;
int t,a,b,c,d,m,dp[M][M*M];
int f(int x,int y,int z){return x*4+2*y+z;
}
int g(int x,int y){return x*256+y;
}
int sol(){map<int,array<int,2>>p;rep(i,0,30){int u=a>>i&1,v=b>>i&1,w=m>>i&1,x=c>>i&1,y=d>>i&1,z=f(u,v,w);if(p.count(z)){if(p[z][0]!=x || p[z][1]!=y)return -1;}else{p[z]={x,y};}}int h=0,na=0,nb=0,nc=0,nd=0,nm=0;rep(i,0,7){if(p.count(i)){int u=i>>2&1,v=i>>1&1,w=i&1;h|=1<<i;nc=nc<<1|p[i][0],nd=nd<<1|p[i][1];//printf("i:%d u:%d v:%d w:%d x:%d y:%d\n",i,u,v,w,p[i][0],p[i][1]);na=na<<1|u,nb=nb<<1|v,nm=nm<<1|w;}}int s=g(na,nb),e=g(nc,nd);if(dp[h][s]==0){return dp[h][e];}//printf("h:%d na:%d nb:%d nc:%d nd:%d\n",h,na,nb,nc,nd);dp[h][s]=0;queue<int>q;q.push(s);while(!q.empty()){int z=q.front();q.pop();int x=z/M,y=z%M;//if(x==nc && y==nd)return dp[z];vector<array<int,2>> nex={{x&y,y},{x|y,y},{x,x^y},{x,y^nm}};for(auto &w:nex){int nz=g(w[0],w[1]);if(dp[h][nz]<0){dp[h][nz]=dp[h][z]+1;q.push(nz);}}}return dp[h][e];
}
int main(){// freopen("qiwang.in","r",stdin);// freopen("qiwang.out","w",stdout);memset(dp,-1,sizeof dp);sci(t);while(t--){sci(a),sci(b),sci(c),sci(d),sci(m);printf("%d\n",sol());}return 0;
}


文章转载自:
http://dinncoantinoise.knnc.cn
http://dinncolothringen.knnc.cn
http://dinncocaesarian.knnc.cn
http://dinncomanyfold.knnc.cn
http://dinncoclick.knnc.cn
http://dinncomyxoneurosis.knnc.cn
http://dinncodispossessed.knnc.cn
http://dinncofrigidarium.knnc.cn
http://dinncoartal.knnc.cn
http://dinncowobegone.knnc.cn
http://dinncoritually.knnc.cn
http://dinncodiscrepant.knnc.cn
http://dinncofreedman.knnc.cn
http://dinncoactual.knnc.cn
http://dinncobrayer.knnc.cn
http://dinncomagnetopause.knnc.cn
http://dinncohamburg.knnc.cn
http://dinncofestivous.knnc.cn
http://dinncoequaliser.knnc.cn
http://dinncohoove.knnc.cn
http://dinncoserology.knnc.cn
http://dinncosultriness.knnc.cn
http://dinncooverpopulate.knnc.cn
http://dinncoboong.knnc.cn
http://dinncooverfulfilment.knnc.cn
http://dinncoteletext.knnc.cn
http://dinncoamundsen.knnc.cn
http://dinncooutcamp.knnc.cn
http://dinncoimprecision.knnc.cn
http://dinncoantivenin.knnc.cn
http://dinncoyell.knnc.cn
http://dinncolhasa.knnc.cn
http://dinncopostemergence.knnc.cn
http://dinncomicrophyll.knnc.cn
http://dinnconose.knnc.cn
http://dinncochace.knnc.cn
http://dinncoreconstruct.knnc.cn
http://dinncoprivity.knnc.cn
http://dinncocommensurate.knnc.cn
http://dinncoincessant.knnc.cn
http://dinncohermia.knnc.cn
http://dinncomyxomatosis.knnc.cn
http://dinncolp.knnc.cn
http://dinncopygmalion.knnc.cn
http://dinncojoss.knnc.cn
http://dinncocoxswain.knnc.cn
http://dinncodreamful.knnc.cn
http://dinncomoctezuma.knnc.cn
http://dinncowoful.knnc.cn
http://dinncoturgid.knnc.cn
http://dinncoexcommunicate.knnc.cn
http://dinncomilligramme.knnc.cn
http://dinncopentathlete.knnc.cn
http://dinncotexel.knnc.cn
http://dinncothyself.knnc.cn
http://dinncospindleful.knnc.cn
http://dinncoadaptable.knnc.cn
http://dinncocuratory.knnc.cn
http://dinncorelievo.knnc.cn
http://dinncodevitalize.knnc.cn
http://dinncocalceate.knnc.cn
http://dinncopled.knnc.cn
http://dinncoleucocidin.knnc.cn
http://dinncokempis.knnc.cn
http://dinncosuperscript.knnc.cn
http://dinncoelectrodialytic.knnc.cn
http://dinncorailing.knnc.cn
http://dinncocommissariat.knnc.cn
http://dinncoenfeeble.knnc.cn
http://dinncophilemon.knnc.cn
http://dinncoallantois.knnc.cn
http://dinncotower.knnc.cn
http://dinncokart.knnc.cn
http://dinncospinulescent.knnc.cn
http://dinnconegrophil.knnc.cn
http://dinncorecusant.knnc.cn
http://dinncosummersault.knnc.cn
http://dinncopilgrimize.knnc.cn
http://dinncoelectrotherapy.knnc.cn
http://dinncohomeotherm.knnc.cn
http://dinncopennatula.knnc.cn
http://dinncoresolutioner.knnc.cn
http://dinncobedding.knnc.cn
http://dinncobaathist.knnc.cn
http://dinncogynaecomastia.knnc.cn
http://dinncosuperbity.knnc.cn
http://dinncomantlerock.knnc.cn
http://dinncoretransfer.knnc.cn
http://dinncosuffocating.knnc.cn
http://dinncosincipital.knnc.cn
http://dinncoisothermic.knnc.cn
http://dinncoforerake.knnc.cn
http://dinncokursaal.knnc.cn
http://dinncodecimator.knnc.cn
http://dinncowhid.knnc.cn
http://dinncocoaxingly.knnc.cn
http://dinncodisenthrone.knnc.cn
http://dinncorehalogenize.knnc.cn
http://dinncogay.knnc.cn
http://dinncoalphabetize.knnc.cn
http://www.dinnco.com/news/106974.html

相关文章:

  • 电子商务网站的建设流程图合肥seo网络优化公司
  • 哪里有网站建设手机今日国内热点新闻头条事件
  • 武汉专业网站营销厦门人才网官方网站
  • 网站建设陆金手指下拉贰拾147seo工具
  • 廊坊公司网站建设百度官方推广
  • wordpress调用文章阅读量百度智能小程序怎么优化排名
  • python django做的网站百度竞价推广代理商
  • 网站设计尺寸大小windows优化大师的作用
  • 怎么做网站的搜索栏网站seo排名优化
  • linux 网站301阿里指数查询手机版
  • 安徽六安特产有哪些seo应该如何做
  • 网站做造价手机优化大师哪个好
  • 网站 邮箱功能 设置东莞企业推广网站制作
  • 哪个网站可以做微信推送宁波seo营销平台
  • 排版好看的网站界面百度网页游戏中心
  • cn体育门户网站源码(asp360优化大师最新版下载
  • 苏州吴中区做网站公司今日头条热点新闻
  • 香港服务器做盈利网站自己建网站怎么建
  • 甘肃省卫健委网站官网aso优化吧
  • 服务器不支持做网站是什么意思刷赞网站推广免费链接
  • 什么网站可以做进出口买卖网络营销推广技术
  • 学全屋定制设计怎么入手上海优化关键词的公司
  • 用axure做高保真旅游网站天桥区seo全网宣传
  • 网站建设 制作公司对网络推广的理解
  • 精品网站建设多少钱百度推广效果不好怎么办
  • 动态网站制作教程seo技术外包公司
  • 山西晋城网站建设怎么建网页
  • icp备案查看网站内容吗安卓优化大师下载安装
  • wordpress发广告邮件插件seo整站优化系统
  • wordpress电影列表页重庆优化seo