CF383E.Vowels

省选/NOI-

通过率:0%

时间限制:4.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Iahubina is tired of so many complicated languages, so she decided to invent a new, simple language. She already made a dictionary consisting of n 3-words. A 3-word is a sequence of exactly 3 lowercase letters of the first 24 letters of the English alphabet (a to x). She decided that some of the letters are vowels, and all the others are consonants. The whole language is based on a simple rule: any word that contains at least one vowel is correct.

Iahubina forgot which letters are the vowels, and wants to find some possible correct sets of vowels. She asks Iahub questions. In each question, she will give Iahub a set of letters considered vowels (in this question). For each question she wants to know how many words of the dictionary are correct, considering the given set of vowels.

Iahubina wants to know the xor of the squared answers to all the possible questions. There are 224 different questions, they are all subsets of the set of the first 24 letters of the English alphabet. Help Iahub find that number.

伊阿胡比娜厌倦了太多复杂的编程语言,因此决定发明一种全新的、简单的语言。她已经创建了一个包含 nn 个“三字母词”的词典。“三字母词”是指由英文字母表前 24 个字母(即 a 到 x)中的小写字母组成的、长度恰好为 3 的序列。她决定将其中某些字母定义为元音字母,其余所有字母则为辅音字母。该语言基于一条简单规则:只要一个词中至少包含一个元音字母,它就是合法的。

伊阿胡比娜忘记了哪些字母是元音字母,现在希望找出一些可能的、合法的元音字母集合。她向伊阿胡提问。在每次提问中,她会给出一个被视作元音字母的字母集合(仅针对该次提问)。对于每次提问,她想知道:在给定的元音字母集合下,词典中有多少个词是合法的。

伊阿胡比娜希望知道:对所有可能的提问所得到的答案分别平方后,再进行异或(xor)运算所得的结果。一共有 2242^{24} 种不同的提问(即英文字母表前 24 个字母的所有子集)。请帮助伊阿胡计算出这个数。

输入格式

The first line contains one integer, n (1 ≤ n ≤ 104). Each of the next n lines contains a 3-word consisting of 3 lowercase letters. There will be no two identical 3-words.

第一行包含一个整数 nn(1≤n≤1041 \leq n \leq 10^4)。接下来的 nn 行,每行包含一个由 3 个小写字母组成的“三字母词”。不存在两个完全相同的三字母词。

输出格式

Print one number, the xor of the squared answers to the queries.

输出一个数字,即所有查询结果的平方值的异或(xor)值。

输入输出样例

  • 输入#1

    5
    abc
    aaa
    ada
    bcd
    def

    输出#1

    0

输入解题思路,AI测评打分。不知道怎么写?

首页