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- ...
随机推荐
- layui点击按钮自动刷新页面问题
问题 <button class="layui-btn layui-btn-primary" onclick="findData()">查询< ...
- error C2872: 'ULONG_PTR' : ambiguous symbol
转自VC错误:http://www.vcerror.com/?p=74 问题描述: 错误:error C2872: 'ULONG_PTR' : ambiguous symbol 解决方法: 详细的解决 ...
- VS2010-MFC(常用控件:树形控件Tree Control 下)
转自:http://www.jizhuomi.com/software/203.html 前面一节讲了树形控件Tree Control的简介.通知消息以及相关数据结构,本节继续讲下半部分,包括树形控件 ...
- Celery - 异步任务 , 定时任务 , 周期任务
1.什么是Celery?Celery 是芹菜Celery 是基于Python实现的模块, 用于执行异步定时周期任务的其结构的组成是由 1.用户任务 app 2.管道 broker 用于存储 ...
- 线性回归代码实现(matlab)
1 代价函数实现(cost function) function J = computeCost(X, y, theta) %COMPUTECOST Compute cost for linear r ...
- 满血复活前的记录(持续更新ing)
时隔一年重新开启算法竞赛征程. 该记录大多为老课件.已经做过的习题重做和已经看过的书本重看 7.21 下午到山大 娄晨耀basic_algorithm课件中的内容: 复习线性筛原理 复习差分 做完Co ...
- android 使用现成做get请求
//接受子线程发来的消息 Handler hanler = new Handler() { @Override public void handleMessage(Message msg) { // ...
- Android开发 Html工具类详解
前言 在一些需求富文本显示或者编辑的开发情况下,数据都是用html的格式来保存文本信息的.而google是有提供解析html的工具类那就是Html.有了Html可以让TextView也支持富文本(其实 ...
- html---三列布局
三列布局 1一 1.两边固定 当中自适应 2.当中列要完整显示 3.当中列要优先加载 <!DOCTYPE html> <html> <head> <meta ...
- Atcoder arc096
C:Half and Half 几个if语句贪心算一算就好了 #include<cstdio> #include<algorithm> using namespace std; ...