303578: CF690E1. Photographs (I)

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

Description

Photographs (I)

题意翻译

### **ps:因洛谷上的题目没有输出格式和样例,所以有部分翻译原文参考官网** ## 题目描述 Heidi 组建的人牛联盟建造了一个防止僵尸攻击的基地, 基地的入口有一个安全门, 这个门执行一种测试, 它会向进入的人 (牛、僵尸) 展示一张照片,并对人 (牛、僵尸) 询问这张照片的上半部分和下半部分是否被交换。人(牛)会认真回答这样的问题; 而僵尸会随便按下两个按钮中的一个。人 (牛、僵尸) 会被询问数次, 如果正确的数量达到或超过 $75$ 个 ,则通向基地的门打开, 否则,通向死亡的门打开。 Heidi 正在组建能消灭僵尸的机器人军队, 她希望你能帮她完成机器人区分图像的功能。 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF690E1/5049ba9bbfc4129520c0662372ea952b95839547.png) 这是测试所用的图片集的前两张,第一张的上下交换过,但第二张并没有。 ## 输入格式 输入第一行为问题数量 $q$ ($1 <= q <= 220$) 每个问题第一行包含两个以空格分隔的整数 $h$ 和 $w$ ($1<=h,w<=600$) 的高度 (行数) 和宽度 (列数) 照片。(多数照片大约为 $200×300$) 在此之后的 $h$ 行,每行为图片的一行 (图片是黑白照片)。第 $i$ 行由 $w$ 空格分隔的整数 $a_{ij}$ 表示 ($j=1, 2, ..., w$) , 其中 $a_{ij}$ 此处的亮度。 ($0<=a_{ij}<256$} (0为黑色,255为白色) 每张照片要么是真实照片,要么是被处理过的照片。准确地说,在后一种情况下,上半部分的图片移动到图片的底部。 保证 $h$ 是偶数。 只有一个输入文件需要处理,文件名为 all.in,可从在线下载。你还有另一个给定的输入文件,文件名为 sample.in,其中包含 all.in 的前 2020 张图片;在 sample.out 中提供了 sample.in 的正确答案。你还将获得一个目录 easy_bmp,其中包含 .bmp 格式的前 50 张输入照片,以及另一个目录 easy_sample_original_bmp,其中包含重新排列之前的前 2020 张图像。 ## 输出格式 输出 $q$ 行。 第 $i$ 行应包含对第 $i$ 个问题的回答:如果照片被处理过,则为“是”,否则为“否”。 如果答案都符合此格式并且至少有 $75\%$ 是正确的,那么你的答案将会判为正确 因为输入很大,所以请在本地处理它并只提交你预先计算的答案(即,一个只打印输出的程序)。 ## 输入输出样例 无 ### 说明/提示 [下载链接](http://assets.codeforces.com/files/690/easy_contestant_package.zip)

题目描述

The Human-Cow Confederation ( $ HC^{2} $ ), led by Heidi, has built a base where people and cows can hide, guarded from zombie attacks. The entrance to the base is protected by an automated gate which performs a kind of a Turing test: it shows the entering creature a photograph and asks them whether the top and bottom halves of this photograph have been swapped or not. A person (or even a cow) will have no problem answering such questions; on the other hand, a zombie would just randomly smash one of the two buttons. The creature is asked a series of such questions. If at least $ 75% $ of them are answered correctly, the gate is unlocked; otherwise, a side door opens, beneath which a huge fan is spinning... Heidi is now building a robot army to fight the zombies, and she wants the robots to also be able to enter the base. You are tasked with programming them to distinguish the images. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF690E1/5049ba9bbfc4129520c0662372ea952b95839547.png)The first two images from the test set. The first picture has been rearranged, but not the second.

输入输出格式

输入格式


The first line of the input contains the number $ q $ of questions ( $ 1<=q<=220 $ ). After that, $ q $ questions follow, each of which in the format described below. The first line of every question contains two space-separated integers $ h $ and $ w $ ( $ 1<=h,w<=600 $ ) – the height (number of rows) and width (number of columns) of the photograph. (Most photographs are roughly $ 200×300 $ .) After this, $ h $ lines follow, each describing a single row of the picture. The picture is monochrome (in shades of grey). Its $ i $ -th row is described by $ w $ space-separated integers $ a_{ij} $ ( $ j=1,...,w $ ), where $ a_{ij} $ is the brightness of the corresponding pixel ( $ 0<=a_{ij}<256 $ , where $ 0 $ is black and $ 255 $ is white). Each picture will be either a real-life photograph, or a real-life photograph which has been broken up into two pieces and rearranged. More precisely, in the latter case, the topmost ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF690E1/568e61a98a42ddbec25913a1d27f1db5aeb559a8.png) rows have been moved to the bottom of the picture. It is guaranteed that $ h $ is even. There is only a single input file to be processed, called all.in, and it is downloadable from the online judge. You are also a given another input file, called sample.in, which contains the first $ 20 $ pictures from all.in; you are provided the correct answers for sample.in in sample.out. You are also given a directory easy\_bmp, which contains the first 50 input photographs in the form of .bmp image files, as well as a directory easy\_sample\_original\_bmp, which contains the first $ 20 $ images before rearrangement. Check the notes for the download links.

输出格式


输入输出样例

暂无测试点

说明

The link to download all necessary files is http://assets.codeforces.com/files/690/easy\_contestant\_package.zip

Input

题意翻译

### **ps:因洛谷上的题目没有输出格式和样例,所以有部分翻译原文参考官网** ## 题目描述 Heidi 组建的人牛联盟建造了一个防止僵尸攻击的基地, 基地的入口有一个安全门, 这个门执行一种测试, 它会向进入的人 (牛、僵尸) 展示一张照片,并对人 (牛、僵尸) 询问这张照片的上半部分和下半部分是否被交换。人(牛)会认真回答这样的问题; 而僵尸会随便按下两个按钮中的一个。人 (牛、僵尸) 会被询问数次, 如果正确的数量达到或超过 $75$ 个 ,则通向基地的门打开, 否则,通向死亡的门打开。 Heidi 正在组建能消灭僵尸的机器人军队, 她希望你能帮她完成机器人区分图像的功能。 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF690E1/5049ba9bbfc4129520c0662372ea952b95839547.png) 这是测试所用的图片集的前两张,第一张的上下交换过,但第二张并没有。 ## 输入格式 输入第一行为问题数量 $q$ ($1 <= q <= 220$) 每个问题第一行包含两个以空格分隔的整数 $h$ 和 $w$ ($1<=h,w<=600$) 的高度 (行数) 和宽度 (列数) 照片。(多数照片大约为 $200×300$) 在此之后的 $h$ 行,每行为图片的一行 (图片是黑白照片)。第 $i$ 行由 $w$ 空格分隔的整数 $a_{ij}$ 表示 ($j=1, 2, ..., w$) , 其中 $a_{ij}$ 此处的亮度。 ($0<=a_{ij}<256$} (0为黑色,255为白色) 每张照片要么是真实照片,要么是被处理过的照片。准确地说,在后一种情况下,上半部分的图片移动到图片的底部。 保证 $h$ 是偶数。 只有一个输入文件需要处理,文件名为 all.in,可从在线下载。你还有另一个给定的输入文件,文件名为 sample.in,其中包含 all.in 的前 2020 张图片;在 sample.out 中提供了 sample.in 的正确答案。你还将获得一个目录 easy_bmp,其中包含 .bmp 格式的前 50 张输入照片,以及另一个目录 easy_sample_original_bmp,其中包含重新排列之前的前 2020 张图像。 ## 输出格式 输出 $q$ 行。 第 $i$ 行应包含对第 $i$ 个问题的回答:如果照片被处理过,则为“是”,否则为“否”。 如果答案都符合此格式并且至少有 $75\%$ 是正确的,那么你的答案将会判为正确 因为输入很大,所以请在本地处理它并只提交你预先计算的答案(即,一个只打印输出的程序)。 ## 输入输出样例 无 ### 说明/提示 [下载链接](http://assets.codeforces.com/files/690/easy_contestant_package.zip)

加入题单

算法标签: