19-10-17-T
真的T了。(滑稽
Final
|
35
|
Miemeng | 100
03:12:51
|
0
03:12:54
|
15
03:12:55
|
115
03:12:55
|
幸好$T1$还能要,不然就……
前言
中午$\scr ZZN$告诉我,快把「×精×落」的代码下下来,不然下午$T1$是个神题一定跪。
$emm\dots$
思考良久……下午并没有下源码。
……
我觉得吧……没必要。
我不是那种一定要高分的人……而且我也不在乎现在的分。反正都垫底
过程
于是开题。
不是神题吧……
看了看觉得可做,就切掉了T1。
后来还查了几个错误。
打了点对拍。
T2T3丢个暴力上去。
后面T2跪了TLE0
题解
尽量写吧。
T1
有人还不会位运算吗?5*7同学问了我半天。
简单哒位运算:
有与,或,非,异或。
与,全1为1,其余为0
或,有1为1,无1为0
异或,不同为1,相同为0
非(这里说的是取反),0变1,1变0(纯右值表达式)
这里把数$A,B$看做两个集合,$1$看做两个集合中的元素。
然后就好不少。
于是:
好丑
于是有几个等式:
$$
(A\,and\,B)xor(A\,xor\,B)=A\,or\,B \\
(A\,or\,B)xor(A\,and\,B)=A\,xor\,B \\
(A\,or\,B)xor(A\,xor\,B)=A\,and\,B
$$
事实上这些柿子只有判0和知二推一时有用。
下面我们称$A\,and\,B$为集合$\mathcal{A}$
称$A\,or\,B$为集合$\mathcal{S}$
称$A\,xor\,B$为集合$\mathcal{B}$
那么如果我们只知道$\mathcal{S}$显然可以$3^{size_{\mathcal{S}}}$直接算。
剩下的情况可以判$inf$或是$2^{size_{\mathcal{B}}}$
于是代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#define LL long long using namespace std; LL andn,orn,xorn;
LL ppow(LL a,LL b){
LL res=1;
while(b){
if(b&1)res*=a;
a*=a;
b>>=1;
}
return res;
}
LL lowbit(LL x){
return x&(-x);
}
LL count(LL x){
LL n_1=0;
while(x){
n_1++;
x-=lowbit(x);
}
return n_1
}
int main(){
int T;
// freopen("bits.in" ,"r",stdin);\
freopen("bits.out","w",stdout);
cin>>T;
while(T--){
scanf("%lld%lld%lld",&andn,&orn,&xorn);
if(andn==-1 && xorn==-1){
printf("%lld\n",ppow(3,count(orn)));
continue;
}
if(xorn==-1 && orn==-1){
puts("inf");
continue;
}
if(orn==-1 && andn==-1){
puts("inf");
continue;
}
if(xorn==-1)
xorn=orn^andn;
if(orn==-1)
orn=xorn|andn;
if(andn==-1)
andn=orn^xorn;
if((xorn|orn)!=orn || (andn|orn)!=orn || (xorn&andn)!=0){
puts("0");
continue;
}
// cout<<count(orn^andn)<<endl;
printf("%lld\n",1ll<<count(orn^andn));
}
}
T2
考场上以为是个数据结垢,结果只有个$lazy$标记。
考察开桶和时间戳的应用。
……时间戳是好东西。
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 111111
#define V 1111111
#define vis(i) vis[(i)+1000000]
#define LL long long using namespace std;
char xch,xB[1<<15],*xS=xB,*xTT=xB;
#define getc() (xS==xTT&&(xTT=(xS=xB)+fread(xB,1,1<<15,stdin),xS==xTT)?0:*xS++)
inline int read(){
int x=0,f=1;char ch=getc();
while(ch<'0'|ch>'9'){if(ch=='-')f=-1;ch=getc();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
return x*f;
}
int cn,
vis[V<<1],
mkv,
siz,
tim=1,
nn;
LL ans=0;
int main(){
int dat;
cn=read();
for(int i=1;i<=cn;i++){
int opt=read();
if(opt==1){
nn=read();
for(int j=1;j<=nn;j++){
dat=read();
if(vis(dat-mkv)!=tim){
ans+=dat;
siz++;
}
vis(dat-mkv)=tim;
}
}
else if(opt==2){
tim++;
nn=read();
ans=0,siz=0;
for(int j=1;j<=nn;j++){
dat=read();
if(vis(dat-mkv)==tim-1){
ans+=dat;
siz++;
vis(dat-mkv)=tim;
}
}
}
else if(opt==3){
mkv++;
ans+=siz;
}
else if(opt==4){
mkv--;
ans-=siz;
}
printf("%lld\n",ans);
}
}
T3
先咕着。
19-10-17-T的更多相关文章
- Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24
作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...
- Ubuntu 19.10将使用GCC 9作为默认编译器
作为我们这一周期一直期待的变化,Ubuntu 19.10升级到GCC 9作为GCC 8的默认系统编译器. Ubuntu 19.10(和Ubuntu 20.04 LTS)将使用GCC 9 stable作 ...
- 背水一战 Windows 10 (17) - 动画: ThemeTransition(过渡效果)
[源码下载] 背水一战 Windows 10 (17) - 动画: ThemeTransition(过渡效果) 作者:webabcd 介绍背水一战 Windows 10 之 动画 ThemeTrans ...
- 发现struct proc_dir_entry内核3.10.17移到internal中去了,倒
struct proc_dir_entry 原:2.6.38.8 在#include <linux/proc_fs.h> 现:3.10.17 在fs/proc/internal.h:str ...
- Windows 8.1 正式版微软官方原版镜像下载(新增10/17新版下载)
中文版:中国区OEM预装版本,特定国家版,锁定语言,其它功能和核心版没有区别.简体中文单语言版:锁定语言,其它功能和核心版没有区别.专业版+核心版[零售版][推荐]:镜像内包含专业版(Professi ...
- Dell Technology Summit(2018.10.17)
时间:2018.10.17地点:北京国家会议中心
- 10.17 NOIP模拟赛
目录 2018.10.17 NOIP模拟赛 A 咒语curse B 神光light(二分 DP) C 迷宫maze(次短路) 考试代码 B 2018.10.17 NOIP模拟赛 时间:1h15min( ...
- WIN8.1 PRO RTM VOL.Enterprise.2013.10.17
Windows 8.1 Pro VL (x64) - DVD (Chinese-Simplified)ISO|Chinese - Simplified|发布日期: 2013/10/17文件名: cn_ ...
- [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录
在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...
- [Linux] 树莓派 4B 安装 Ubuntu 19.10 (Eoan Ermine) IOT 版
硬件:Raspberry Pi 4B系统:Ubuntu 19.10 (Eoan Ermine) for IOT官网:https://ubuntu.com/download/iot/raspberry- ...
随机推荐
- 广义欧拉降幂(欧拉定理)——bzoj3884,fzu1759
广义欧拉降幂对于狭义欧拉降幂任然适用 https://blog.csdn.net/qq_37632935/article/details/81264965?tdsourcetag=s_pctim_ai ...
- python用类实现装饰器
一.代码 #利用__call__方法,装饰器的执行流程:当添加装饰器语法糖时,会把语法糖的变量名加()执行,并将被装饰的函数名传入.所以当类加()执行时,执行了__init__,产生的对象就是被装饰的 ...
- day22_2-sys模块
# ********************day22_2-sys模块 *******************# ********************day22_2-sys模块 ********* ...
- <每日一题>题目30:已知一个长度n的无序列表,元素均是数字,要求把所有间隔为d的组合找出来
def select_d(list,d): # list = sorted(list) sum = {} for i in list: if i+d in list: sum[i] = i+d ret ...
- springcloud系列12 config的使用
config组件分为server端和client端 config的原理: 就是当我们将配置文件放置在git上面,那么configserver就会去拉取相关配置文件至本地: 可以看到我本地是拉去了配置文 ...
- visual studio 注释模板
/*----------------------------------------------------------------* 项目名称 :$rootnamespace$* 项目描述 :* 类 ...
- HttpClientUitl工具类
public class HttpClient { private CloseableHttpClient httpClient; public HttpClient() { this.httpCli ...
- JS规则 给变量取个名字(变量命名) 必须以字母、下划线或美元符号开头;区分大小写;不允许使用JS关键字或保留字
给变量取个名字(变量命名) 我们为了区分盒子,可以用BOX1,BOX2等名称代表不同盒子,BOX1就是盒子的名字(也就是变量的名字). 我们赶快给变量取个好名字吧!变量名字可以任意取,只不过取名字要遵 ...
- spring:常用的注解
bean.xml中配置依赖 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...
- commons lang3的StringUtils中isEmpty()方法和isBlank()方法的区别
先给结论: 1. StringUtils.isEmpty()中的空格作非空处理2. StringUtils.isNotEmpty()是StringUtils.isEmpty()取反后的结果3. Str ...