301369: CF256D. Liars and Serge

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Liars and Serge

题意翻译

$n$ 个人坐成一排,编号为 $1$ 到 $n$,诚实的人说真话,虚伪的人说假话,每个人都知道场上几个人说真话,几个人说假话。 `小S` 想要知道场上每个人的身份,对此他问每一个人一个问题。 一个编号为 $i$ 的人会回答一个数 $a_i$。如果这个人是诚实的,那么他会回答场上诚实的人的人数,如果这个人是虚伪的,那么他会随机回答一个 $1$ 到 $n$ 中的不是场上诚实人数的数。 现在 `小S` 想知道有多少个可能的回答序列 $a$,使得 `小S` 能够断定其中恰好有 $k$ 个人 **一定** 是虚伪的人(不包括不确定的),由于答案可能很大,请输出其对 $777777777$ 取模的结果。 $1\leq k \leq n\leq 2^8$,保证 $n$ 为 $2$ 的幂。

题目描述

There are $ n $ people, sitting in a line at the table. For each person we know that he always tells either the truth or lies. Little Serge asked them: how many of you always tell the truth? Each of the people at the table knows everything (who is an honest person and who is a liar) about all the people at the table. The honest people are going to say the correct answer, the liars are going to say any integer from 1 to $ n $ , which is not the correct answer. Every liar chooses his answer, regardless of the other liars, so two distinct liars may give distinct answer. Serge does not know any information about the people besides their answers to his question. He took a piece of paper and wrote $ n $ integers $ a_{1},a_{2},...,a_{n} $ , where $ a_{i} $ is the answer of the $ i $ -th person in the row. Given this sequence, Serge determined that exactly $ k $ people sitting at the table apparently lie. Serge wonders, how many variants of people's answers (sequences of answers $ a $ of length $ n $ ) there are where one can say that exactly $ k $ people sitting at the table apparently lie. As there can be rather many described variants of answers, count the remainder of dividing the number of the variants by $ 777777777 $ .

输入输出格式

输入格式


The first line contains two integers $ n $ , $ k $ , $ (1<=k<=n<=2^{8}) $ . It is guaranteed that $ n $ — is the power of number 2.

输出格式


Print a single integer — the answer to the problem modulo $ 777777777 $ .

输入输出样例

输入样例 #1

1 1

输出样例 #1

0

输入样例 #2

2 1

输出样例 #2

2

Input

题意翻译

$n$ 个人坐成一排,编号为 $1$ 到 $n$,诚实的人说真话,虚伪的人说假话,每个人都知道场上几个人说真话,几个人说假话。 `小S` 想要知道场上每个人的身份,对此他问每一个人一个问题。 一个编号为 $i$ 的人会回答一个数 $a_i$。如果这个人是诚实的,那么他会回答场上诚实的人的人数,如果这个人是虚伪的,那么他会随机回答一个 $1$ 到 $n$ 中的不是场上诚实人数的数。 现在 `小S` 想知道有多少个可能的回答序列 $a$,使得 `小S` 能够断定其中恰好有 $k$ 个人 **一定** 是虚伪的人(不包括不确定的),由于答案可能很大,请输出其对 $777777777$ 取模的结果。 $1\leq k \leq n\leq 2^8$,保证 $n$ 为 $2$ 的幂。

加入题单

算法标签: