# JZOJ.2020.05.23【NOIP提高组】模拟（反思）

2020-05-23 12:52:16  阅读：28  来源： 互联网

110

T1 WA 70

T2 WA 20

## Bovine Genomics

```Description
FJ有n头有斑点的牛和n头没有斑点的牛。由于他刚刚学完牛的基因学的课程，他想知道牛有没有斑点是否与牛的基因有关。
FJ花了巨大的代价测出了每个牛的基因，每头牛的基因用一个长度为M的由“A,C,G,T”的串构成。FJ将这些串写成一个表/矩阵，就像图中这样（N=3的例子）

FJ仔细的观察这个表，他发现通过观测2,4位置的字符串可以预测牛是否有斑点。
（在这个例子中，假如他看到24位置是GC、AT或者AC就可以断定其有斑点，因为1号有斑点的牛24位置基因为AC，2号为AT，3号为GC，而且没有任何一头无斑点的牛的24位置出现过这三个串）。
FJ认为，1个或者两个位点是不能够区分品种的，必须是刚好3个位点。他想知道能用多少组三个本质不同的位置判断牛的斑点，{1,2,3}和{1,3,2}是本质相同的

Input
The first line of input contains N ( 1 ≤ N ≤ 500 ) and M ( 3 ≤ M ≤ 50 ). The next N lines each contain a string of M characters; these describe the genomes of the spotty cows. The final N lines describe the genomes of the plain cows.

Output
Please count the number of sets of three distinct positions that can explain spottiness. A set of three positions explains spottiness if the spottiness trait can be predicted with perfect accuracy among Farmer John's population of cows by looking at just those three locations in the genome.

Sample Input
3 8
AATCCCAT
GATTGCAA
GGTCGCAA
ACTCCCAG
ACTCGCAT
ACTTCCAT
```

## Where's Bessie?

```Description

ABABA
AAABB

Input
The first line of input contains N , the size of the grid ( 1 ≤ N ≤ 20 ). The next N lines describe the image, each consisting of N characters.

Output
Print a count of the number of PCLs in the image.

Sample Input
4
ABBC
BBBC
AABB
ABBC

Sample Output
2

Data Constraint

Hint
In this example, the two PCLs are the rectangles with contents

ABB
BBB
AAB
ABB

and

BC
BC
BB
BC
```

## Modern Art

```Description

2 2 2 0

2 2 2 0

2 2 2 0

0 0 0 0

2 2 2 0

2 7 7 7

2 7 7 7

0 0 0 0

2 2 3 0

2 7 3 7

2 7 7 7

0 0 0 0

Input
The first line of input contains N , the size of the canvas ( 1 ≤ N ≤ 1000 ). The next N lines describe the final picture of the canvas, each containing N integers that are in the range 0 … N^2 . The input is guaranteed to have been drawn as described above, by painting successive rectangles in different colors.

Output
Please output a count of the number of colors that could have been drawn first.

Sample Input
4
2 2 3 0
2 7 3 7
2 7 7 7
0 0 0 0

Sample Output
14

Data Constraint

Hint
In this example, color 2 could have been the first to be painted. Color 3 clearly had to have been painted after color 7, and color 7 clearly had to have been painted after color 2. Since we don't see the other colors, we deduce that they also could have been painted first.
```