真的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的更多相关文章

  1. Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24

    作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...

  2. Ubuntu 19.10将使用GCC 9作为默认编译器

    作为我们这一周期一直期待的变化,Ubuntu 19.10升级到GCC 9作为GCC 8的默认系统编译器. Ubuntu 19.10(和Ubuntu 20.04 LTS)将使用GCC 9 stable作 ...

  3. 背水一战 Windows 10 (17) - 动画: ThemeTransition(过渡效果)

    [源码下载] 背水一战 Windows 10 (17) - 动画: ThemeTransition(过渡效果) 作者:webabcd 介绍背水一战 Windows 10 之 动画 ThemeTrans ...

  4. 发现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 ...

  5. Windows 8.1 正式版微软官方原版镜像下载(新增10/17新版下载)

    中文版:中国区OEM预装版本,特定国家版,锁定语言,其它功能和核心版没有区别.简体中文单语言版:锁定语言,其它功能和核心版没有区别.专业版+核心版[零售版][推荐]:镜像内包含专业版(Professi ...

  6. Dell Technology Summit(2018.10.17)

    时间:2018.10.17地点:北京国家会议中心

  7. 10.17 NOIP模拟赛

    目录 2018.10.17 NOIP模拟赛 A 咒语curse B 神光light(二分 DP) C 迷宫maze(次短路) 考试代码 B 2018.10.17 NOIP模拟赛 时间:1h15min( ...

  8. 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_ ...

  9. [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录

    在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...

  10. [Linux] 树莓派 4B 安装 Ubuntu 19.10 (Eoan Ermine) IOT 版

    硬件:Raspberry Pi 4B系统:Ubuntu 19.10 (Eoan Ermine) for IOT官网:https://ubuntu.com/download/iot/raspberry- ...

随机推荐

  1. golang中time包一个简单的时间格式输出

    一.代码 package main import ( "fmt" "time" ) func main() { //"2006-01-02 15:04 ...

  2. System.Web.Mvc.HttpPostAttribute.cs

    ylbtech-System.Web.Mvc.HttpPostAttribute.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutral, ...

  3. 《DSP using MATLAB》Problem 8.39

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  4. Jodd - Java界的瑞士军刀轻量级工具包!

    Jodd介绍 Jodd是对于Java开发更便捷的开源迷你框架,包含工具类.实用功能的集合,总包体积不到1.7M. Jodd构建于通用场景使开发变得简单,但Jodd并不简单!它能让你把事情做得更好,实现 ...

  5. 关于vlfeat做vlad编码问题

    这里是官方文档,可以自己查看 在这里,只是想记录一下,我这几天学习vlfeat 做vlad编码的过程,便于以后整理 网上涉及到vlfeat做vlad编码资料较少,而官网上例子又相对简单,主要是那几个参 ...

  6. telnet- Linux必学的60个命令

    1.作用 telnet表示开启终端机阶段作业,并登入远端主机.telnet是一个Linux命令,同时也是一个协议(远程登陆协议). 2.格式 telnet [-8acdEfFKLrx][-b][-e] ...

  7. MATLAB 去掉数组里面不要的元素

    trainfinger=1 testingfinger=(1:8); testingfinger = testingfinger(~ismember(testingfinger,trainfinger ...

  8. 函数的作用域、作用域链以及return关键字

    1.作用域 全局作用域:在函数外部使用var关键字定义的变量 局部作用域:在函数内部使用var关键字定义的变量 特点   (1)局部变量无法直接影响全局变量    (2)在局部作用域中可以使用全局作用 ...

  9. 关于join的一些补充

    1, 为什么join是string的method而不是list的method http://effbot.org/pyfaq/why-is-join-a-string-method-instead-o ...

  10. Flink Checkpoint 问题排查实用指南

    在 Flink 中,状态可靠性保证由 Checkpoint 支持,当作业出现 failover 的情况下,Flink 会从最近成功的 Checkpoint 恢复.在实际情况中,我们可能会遇到 Chec ...