日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Not Wool Sequences(CF-239C)

發布時間:2025/3/17 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Not Wool Sequences(CF-239C) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Problem Description

A sequence of non-negative integers?a1,?a2,?...,?an?of length?n?is called a?wool sequence?if and only if there exists two integers?l?and?r?(1?≤?l?≤?r?≤?n)?such that?. In other words each wool sequence contains a subsequence of consecutive elements with xor equal to 0.

The expression??means applying the operation of a bitwise xor to numbers?x?and?y. The given operation exists in all modern programming languages, for example, in languages?C++?and?Java?it is marked as "^", in?Pascal?— as "xor".

In this problem you are asked to compute the number of sequences made of?n?integers from 0 to?2m?-?1?that are not a wool sequence. You should print this number modulo?1000000009?(109?+?9).

Input

The only line of input contains two space-separated integers?n?and?m?(1?≤?n,?m?≤?105).

Output

Print the required number of sequences modulo 1000000009 (109 + 9) on the only line of output.

Examples

Input

3 2

Output

6

Note

Sequences of length?3?made of integers 0, 1, 2 and 3 that are not a wool sequence are?(1, 3, 1),?(1, 2, 1),?(2, 1, 2),?(2, 3, 2),?(3, 1, 3)?and?(3, 2, 3).

題意:給出 n、m 兩個數,現在要在 0~2^m-1 個數中取可重復的 n 個數,使得組成的序列異或和為 0,問這 2^m-1 個數中組成的序列有多少個滿足要求

思路:

設一個前綴數組,使得 sum[i]=sum[i-1]^a[i],那么 a[i]=sum[i-1]^sum[i]

假設 0~2^m-1 不是一個滿足要求的序列,那么 a[l]^a[l+1]^...^a[r]!=0,即有:sum[l-1]^sum[r]!=0

由于 l<=r,因此 sum 數組中的所有數需要兩兩不同

又因為 a[i]=sum[i-1]^sum[i],因此 sum[i] 的取值在 [1,2^m]

因此,問題就變成求有多少個長度為 n 的數組,且數組中的數在 [1,2^m] 之間且不相同

Source Program

#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<utility> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #include<bitset> #define EPS 1e-9 #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long const int MOD = 1E9+9; const int N = 1000000+5; const int dx[] = {-1,1,0,0,-1,-1,1,1}; const int dy[] = {0,0,-1,1,-1,1,-1,1}; using namespace std;int main(){LL n,m;scanf("%lld%lld",&n,&m);LL mul=1,res=1;for(int i=1;i<=m;i++)mul=(mul*2)%MOD;for(int i=1;i<=n;i++)res=(res*(mul-i))%MOD;printf("%lld\n",res);return 0; }

?

總結

以上是生活随笔為你收集整理的Not Wool Sequences(CF-239C)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 午夜精品国产 | 欧美人体视频一区二区三区 | 这里只有精品视频在线观看 | 人妖黄色片 | 玖玖视频网 | 欧日韩不卡视频 | 亚洲免费砖区 | 少妇一夜三次一区二区 | 污片免费观看 | jizzjizz8| 久久99在线 | 黄色在线一区 | 日韩美女免费线视频 | 亚洲国产成人久久 | 欧美日性视频 | 四色成人av永久网址 | 黄色美女一级片 | 久久视频黄色 | 大地资源二中文在线影视免费观看 | 久久av在线 | 超级碰在线视频 | 91原创国产 | 亚洲视频 欧美视频 | 美国一级大黄一片免费中文 | jzzijzzij亚洲成熟少妇在线观看 久久久精品人妻一区二区三区 | 黄色片视频免费看 | 66av欧美| 国产伦精品一区二区三区视频孕妇 | 国产日韩一级 | 激情综合六月 | av动漫网| 69精品国产 | 免费看污片网站 | xx99小雪| www网站在线观看 | 青青青青操 | 视频二区欧美 | 在线观看黄网站 | 91成人在线免费 | 亚洲日本中文字幕 | 国产亚洲精久久久久久无码苍井空 | 国产jjizz一区二区三区视频 | 亚洲一级色 | 日本免费在线播放 | 亚洲成人999 | 国产做爰全过程免费视频 | 秋霞成人午夜伦在线观看 | 久久精品99 | 国产亚洲福利 | 日本特黄色片 | 99re视频 | 精品国产一区二区三区四区阿崩 | 日韩欧美字幕 | 日韩黄视频 | 国产精品亚洲成在人线 | 国偷自产av一区二区三区 | 贝利弗山的秘密在线观看 | 波多野结衣不卡 | 在线视频 一区二区 | 国产精品久久综合青草亚洲AV | 欧美亚洲黄色片 | 久久久久亚洲AV成人网人人小说 | 欧美色图首页 | 高跟丝袜av| 国产成人免费在线观看 | 69精品 | 134vcc影院免费观看 | 黄色一级视频在线观看 | 台湾a级艳片潘金莲 | 天天色婷婷 | 国产一级二级三级视频 | 久久久精品人妻av一区二区三区 | 巨骚综合| 国产一区二区视频在线观看免费 | 国产传媒视频在线 | 在线视频免费观看 | 欧美另类高清videos的特点 | www.youjizz.com在线观看 | 69国产成人精品二区 | 高潮毛片 | 亚洲另类一区二区 | 国产一级二级 | 日韩深夜视频 | 欧美va亚洲va | 色网在线观看 | 初尝人妻少妇中文字幕 | 国产一区二区视频播放 | 欧美性大战久久久久久 | aaaaaav| 国产盗摄在线观看 | 亚洲欧美另类日韩 | 久久久高潮| 亚洲图片小说区 | 中文字幕一区二区在线观看视频 | www.超碰97.com| 国产精品成人午夜视频 | 欧美国产日韩精品 | 麻豆影视国产在线观看 | 国产精品区二区三区日本 |