A14570 | October 18, 2017
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
It was October 18, 2017. Shohag, a melancholic soul, made a strong determination that he will pursue Competitive Programming seriously, by heart, because he found it fascinating. Fast forward to 4 years, he is happy that he took this road. He is now creating a contest on Codeforces. He found an astounding problem but has no idea how to solve this. Help him to solve the final problem of the round.
You are given three integers $n$ , $k$ and $x$ . Find the number, modulo $998\,244\,353$ , of integer sequences $a_1, a_2, \ldots, a_n$ such that the following conditions are satisfied:
- $0 \le a_i \lt 2^k$ for each integer $i$ from $1$ to $n$ .
- There is no non-empty subsequence in $a$ such that the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of the elements of the subsequence is $x$ .
A sequence $b$ is a subsequence of a sequence $c$ if $b$ can be obtained from $c$ by deletion of several (possibly, zero or all) elements.
You are given three integers $n$ , $k$ and $x$ . Find the number, modulo $998\,244\,353$ , of integer sequences $a_1, a_2, \ldots, a_n$ such that the following conditions are satisfied:
- $0 \le a_i \lt 2^k$ for each integer $i$ from $1$ to $n$ .
- There is no non-empty subsequence in $a$ such that the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of the elements of the subsequence is $x$ .
A sequence $b$ is a subsequence of a sequence $c$ if $b$ can be obtained from $c$ by deletion of several (possibly, zero or all) elements.
输入格式
The first line contains a single integer $t$ ( $1 \le t \le 10^5$ ) — the number of test cases.
The first and only line of each test case contains three space-separated integers $n$ , $k$ , and $x$ ( $1 \le n \le 10^9$ , $0 \le k \le 10^7$ , $0 \le x \lt 2^{\operatorname{min}(20, k)}$ ).
It is guaranteed that the sum of $k$ over all test cases does not exceed $5 \cdot 10^7$ .
The first and only line of each test case contains three space-separated integers $n$ , $k$ , and $x$ ( $1 \le n \le 10^9$ , $0 \le k \le 10^7$ , $0 \le x \lt 2^{\operatorname{min}(20, k)}$ ).
It is guaranteed that the sum of $k$ over all test cases does not exceed $5 \cdot 10^7$ .
输出格式
For each test case, print a single integer — the answer to the problem.
输入输出样例
输入 #1
6 2 2 0 2 1 1 3 2 3 69 69 69 2017 10 18 5 7 0
输出 #1
6 1 15 699496932 892852568 713939942
In the first test case, the valid sequences are $[1, 2]$ , $[1, 3]$ , $[2, 1]$ , $[2, 3]$ , $[3, 1]$ and $[3, 2]$ .
In the second test case, the only valid sequence is $[0, 0]$ .
In the second test case, the only valid sequence is $[0, 0]$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted