关于$Miemeng$,它死了。

大家有没有记得我在暑假里曾经写过一个著名模数?

const int Mod=998224353;

现在有续集了(捂脸)(改不过题.jpg)

const int Mod=988244353;

ZJ:

我对不起大家我又咕咕咕了,话说为什么我挂起的电脑……

T1Adore,看起来很熟悉……不知道是什么时候见过这个词……

于是发现不可做。打一个暴力就丢了。

T2发现暴力很好打,先码了一个,先rand了几个数据,发现答案大都是$1\ 2$

emm,本来想一边输入一边扫,但是后来弃掉了(为什么要弃啊啊啊?

T3发现很贪心,但是只会输出$n$(滑稽

(后来听说输出$\frac{n}{s}$有$50$)

39
Miemeng 0

00:00:03
50

00:00:04
20

00:00:05
70

00:00:05

啊T1为什么爆〇了????

TJ:

T1

状压即可,设$f_{i,s}$为第$i$层点权奇偶性为$s$(奇为$1$,偶为$0$)时前$i$层的方案数

于是预处理取反边,并且直接转移就好了。

最后的答案就是$f_{n,0}$

复杂度$\Theta(NK 2^K)$

#include <iostream>
#include <cstring>
#include <cstdio> //#include "debug.h" #define N 11111
#define K 12
#define S (1<<K)+111
#define LL long long
using namespace std; const int Mod=998244353;
int cn,pn;
LL dp[N][S];
int mp[N][K],pm[N][K];
int dat[N][K][K]; void prerun(){
for(int i=1;i<=pn;i++){
mp[1][1] |= dat[1][1][i]<<(i-1);
}
for(int i=2;i<cn-1;i++){
for(int j=1;j<=pn;j++){
for(int k=1;k<=pn;k++){
mp[i][j] |= dat[i][j][k]<<(k-1);
pm[i][k] |= dat[i][j][k]<<(j-1);
}
}
}
for(int i=1;i<=pn;i++){
mp[cn-1][i] |= dat[cn-1][i][1];
// cout<<mp[cn-1][i]<<" ";
}
// cout<<endl;
}
int main(){
#ifndef LOCAL
freopen("adore.in" ,"r",stdin);
freopen("adore.out","w",stdout);
#endif
scanf("%d%d",&cn,&pn);
for(int i=1;i<=pn;i++){
scanf("%d",&dat[1][1][i]);
}
for(int i=2;i<cn-1;i++){
for(int j=1;j<=pn;j++){
for(int k=1;k<=pn;k++){
scanf("%d",&dat[i][j][k]);
}
}
}
for(int i=1;i<=pn;i++){
scanf("%d",&dat[cn-1][i][1]);
}
prerun();
/* for(int i=1;i<=cn;i++){
for(int j=1;j<=pn;j++){
cout<<i<<" "<<j<<" "<<bin(mp[i][j],pn)<<endl;
}
}*/
dp[2][mp[1][1]]=1;
for(int i=2;i<cn-1;i++){
for(int s=0;s<1<<pn;s++){
// cout<<"dp["<<i<<"]["<<bin(s,pn)<<"]="<<dp[i][s]<<endl;
int pos=0,sop=0;
for(int j=1;j<=pn;j++){
int k=1<<(j-1);
if(k&s){
pos^=mp[i][j];
sop^=pm[i][j];
}
}
dp[i+1][pos]+=dp[i][s];
dp[i+1][pos]%=Mod;
dp[i+1][sop]+=dp[i][s];
dp[i+1][sop]%=Mod;
}
}
for(int s=0;s<1<<pn;s++){
int pos=0;
// cout<<"dp["<<cn-1<<"]["<<bin(s,pn)<<"]="<<dp[cn-1][s]<<endl;
for(int i=1;i<=pn;i++){
int j=1<<(i-1);
if(j&s){
pos^=mp[cn-1][i];
// cout<<"pos:"<<bin(pos,pn)<<"<-"<<j<<" "<<mp[cn-1][j]<<endl;
}
}
dp[cn][pos]+=dp[cn-1][s];
dp[cn][pos]%=Mod;
}
printf("%lld\n",dp[cn][0]);
}

T2:

考试的小剪枝暴力tong过本题。

#include <iostream>
#include <cstring>
#include <cstdio>
#include <bitset>
#define N 6666
using namespace std; int sn;
char str[N*100];
bitset <2*N> vals[N];
int main(){
#ifndef LOCAL
freopen("confess.in" ,"r",stdin);
freopen("confess.out","w",stdout);
#endif
scanf("%d",&sn);
for(int i=1;i<=sn+1;i++){
int cnt=0;
scanf("%s",str);
int len=strlen(str);
for(int j=0;j<len;j++){
int dat=str[j]-33;
for(int k=0;k<6;k++){
vals[i]<<=1;
cnt++;
vals[i].set(0,dat>>k&1);
if(cnt==2*sn)goto nxtt;
}
}
nxtt:;
for(int j=1;j<i;j++){
if((int)(vals[i]&vals[j]).count()>=sn/2){
cout<<i<<" "<<j<<endl;
return 0;
}
}
}
}

但是正解是随机化……

(随机化可过的题大多都可以暴力剪枝过……)

T3咕掉了,也不想粘题解。

19-11-10-Night的更多相关文章

  1. Update 19.11 for Azure Sphere

    今天,微软发布了面向Azure Sphere的19.11更新,其主要亮点就是加入了对开发工具Visual Studio Code和Linux开发环境的支持.具体来讲,本次更新包含3个部分: 1. Az ...

  2. 2016/11/10 吃吃喝喝Hacking Thursday Night聚餐活动 at Dunkin Donuts

    店名:Dunkin Donuts 唐恩都乐 点评:http://www.dianping.com/shop/21378231 地址:静安区南京西路1649号静安公园内(近静安公园) 走法:地铁2号线静 ...

  3. 微信iphone7、 ios10播放视频解决方案 2016.11.10

    2016.11.10日更新以下方法 微信最新出同层播放规范 即使是官方的也无法解决所有android手机的问题. 另外iphone 5 .5s 某些手机始终会弹出播放,请继续采用 “以下是老的解决办法 ...

  4. ubuntu 11.10 安装apache2 tomcat6

    ubuntu 11.10 安装apache2 tomcat6 导读 Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目 ...

  5. 【转】ubuntu 11.10(32位系统)下编译android源码

    原文网址:http://www.cnblogs.com/dwayne/archive/2011/11/16/2251734.html 本文介绍在ubuntu 11.10系统下编译android 2.3 ...

  6. Ubuntu 11.10 安装GMONE3,卸载 UNITY和UNITY 2D

    Ubuntu 11.10安装GNOME3: 1)sudo apt-get install gnome-shell    sudo apt-get install gnome-themes*   (或者 ...

  7. 在Ubuntu 11.10工具栏上用数字显示网速、CPU负荷和内存占用量『译』

    基本上照抄了<How To Display Network Upload / Download Speed On The Panel In Ubuntu 11.04>,只不过我的实践环境是 ...

  8. Ubuntu 11.10 Server下搭建Maven私服

      安装Nexus服务的文档可以参考官方站点:http://www.sonatype.com/books/nexus-book/reference/install-sect-install.html ...

  9. Ubuntu 11.10下GRUB 2 1.99版编译安装笔记

    Ubuntu 11.10下GRUB 2 1.99版编译安装笔记 以下的安装笔记,都是QLi自己学习grub2 时,所整理的,还是新手,有错误的话,请大家帮忙就别提出来了. 最新版grub V1.99官 ...

  10. 显示 Ubuntu 11.10 的 终端窗口

    显示 Ubuntu 11.10 的 终端窗口 一.点击左上角的图标 -> 在search框里搜索termial . 二.快捷键:Ctrl+Alt+t.

随机推荐

  1. 案例 查询QC(query_cache)

    案例: 数据库版本 5.7.23 16c 64g 按月分区表,做压力测试 开启QC之前: select * from a where aa=xxx; QPS:每秒处理查询的数量 3000+ 开启之后 ...

  2. SparkStreaming整合Flume的pull方式之启动报错解决方案

    Flume配置文件: simple-agent.sources = netcat-source simple-agent.sinks = spark-sink simple-agent.channel ...

  3. 大道浮屠诀---NBU报错代码之status2

    在一次windows2008R2系统上部署7.7.3备份过程中遇到了此报错 当备份catalog时,会出现status 2报错 经过一系列排查后,得出如下解决方法 1.任务进程中有大量的nbtelem ...

  4. Southeastern European Regional Programming Contest 2019

    easy: I medium-easy: BDEGJ medium: F medium-hard: A A. B. 按 x 排序,\(dp[i][j][k]\) 表示考虑前 \(i\) 个物品,lev ...

  5. 哈理工赛 H-小乐乐学数学 /// 筛法得素数表+树状数组

    题目大意: 给定n个数 m个询问 询问l r区间内的孤独数的个数 孤独数的定义为在该区间内与其他所有数互质的数 看注释 #include <bits/stdc++.h> using nam ...

  6. 我写的第一个DELPHI的控制台程序,留作纪念。

    program Project2; {$APPTYPE CONSOLE} uses  SysUtils; const s = 'hello' ;  var a , b , c : integer; f ...

  7. Tesseract&tesseractOCRiOS

    安装tesseract在上篇. 1.安装之后默认语言包只有英文包,在github上下载中文简体,链接:https://github.com/tesseract-ocr/tessdata 然后放入tes ...

  8. 2018-8-10-win10-uwp-在-Canvas-放一个超过大小的元素会不会被裁剪

    title author date CreateTime categories win10 uwp 在 Canvas 放一个超过大小的元素会不会被裁剪 lindexi 2018-08-10 19:16 ...

  9. Spark三种部署方式

  10. JS事件 内容选中事件(onselect)选中事件,当文本框或者文本域中的文字被选中时,触发onselect事件,同时调用的程序就会被执行。

    内容选中事件(onselect) 选中事件,当文本框或者文本域中的文字被选中时,触发onselect事件,同时调用的程序就会被执行. 如下代码,当选中用户文本框内的文字时,触发onselect 事件, ...