关于$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. python批量运行py文件

    import os path="E:\\python" #批量的py文件路径 for root,dirs,files in os.walk(path): #进入文件夹目录 for ...

  2. jquery与zend framework编写的联动选项效果

    html部分: <pre name="code" class="html"><!DOCTYPE html PUBLIC "-//W3 ...

  3. bias、variance与拟合之间的关系

    Error = Bias^2 + Variance+Noise 误差的原因: 1.Bias反映的是模型在样本上的输出与真实值之间的误差,即模型本身的精准度,即算法本身的拟合能力. 2.Variance ...

  4. leetcode-63-不同路径②

    题目描述: 第一次提交: class Solution: def uniquePathsWithObstacles(self, obstacleGrid) : m = len(obstacleGrid ...

  5. Java 多线程 - 死锁deadlock产生原因+避免方法

    ref: java中产生死锁的原因及如何避免 https://blog.csdn.net/m0_38126177/article/details/78587845 java如何避免死锁 http:// ...

  6. SQLite wrapper

    SQLiteWrapper is a C++ wrapper for SQLite. There are some test programs that demonstrate how the SQL ...

  7. python封装email模块

    一.代码 from email.mime.text import MIMEText from email.header import Header from email.utils import pa ...

  8. hive 总结二

    本文参考:黑泽君相关博客 本文是我总结日常工作中遇到的坑,结合黑泽君相关博客,选取.补充了部分内容. 查询函数(Hive高级) NVL(cloumn,replace_with) 如果cloumn为NU ...

  9. 关于tomcat配置了虚拟路径,但是在Idea中无法生效的问题

    1. 确认 tomcat 的server.xml 文件中配置的虚拟路径是否正确 其中,path表示访问的虚拟路径,docBase表示真实路径 2. Idea 服务器配置中是否勾选 “Deploy ap ...

  10. java关键字之instanceof

    首先来看段测试代码 public class TestInstanceof{ public static void main(String[] args){ int a = 1; if(a insta ...