CF690E1.Photographs (I)
普及+/提高
通过率:0%
时间限制:15.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.

The first two images from the test set. The first picture has been rearranged, but not the second.
人类—奶牛联盟(HC₂)在海蒂的领导下,建立了一处供人类与奶牛躲避僵尸袭击的基地。基地入口由一扇自动门把守,该门执行一种图灵测试:向进入者展示一张照片,并询问其该照片的上半部分与下半部分是否已被互换。人类(甚至奶牛)都能轻松回答此类问题;而僵尸则只会随机猛击两个按钮中的一个。
进入者需连续回答一系列此类问题。若其中至少 75% 的问题回答正确,则大门开启;否则,一扇侧门将打开,其下方正有一台巨大的风扇高速旋转……
目前,海蒂正在组建一支机器人军队以对抗僵尸,她希望这些机器人也能顺利进入基地。你的任务是为机器人编写程序,使其能够准确区分图像。

测试集中的前两张图像。第一张图像已被上下互换,第二张则未被互换。
输入格式
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
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.
输入的第一行包含问题数量 q(1 ≤ q ≤ 220)。随后是 q 个问题,每个问题的格式如下所述。
每个问题的第一行包含两个以空格分隔的整数 h 和 w(1 ≤ h, w ≤ 600),分别表示照片的高度(行数)和宽度(列数)。(大多数照片尺寸约为 200 × 300。)随后是 h 行,每行描述照片的一行。该照片为灰度图像(仅含灰度级)。其第 i 行由 w 个以空格分隔的整数 aij(j=1,…,w)描述,其中 aij 表示对应像素的亮度(0 ≤ aij < 256,其中 0 表示黑色,255 表示白色)。
每张图片要么是一张真实生活照片,要么是一张被沿水平中线切开并重新拼接的真实生活照片。更准确地说,在后一种情况下,最上面的
行被移至图片底部。保证 h 为偶数。
仅需处理一个名为 all.in 的输入文件,该文件可从在线评测系统下载。同时提供另一个输入文件 sample.in,其中包含 all.in 中的前 20 张图片;sample.out 文件中提供了 sample.in 对应的正确答案。此外还提供一个目录 easy_bmp,其中包含前 50 张输入照片的 .bmp 图像文件;以及一个目录 easy_sample_original_bmp,其中包含前 20 张图片在重排之前的原始图像。请参阅说明部分获取下载链接。
输出格式
Your program should print q lines. The i-th line should contain your answer for the i-th question: YES if the photograph has been rearranged and NO otherwise. Your answers will be accepted if they all conform to this format and if at least 75% of them are correct.
Because the input is rather huge, feel free to process it locally and submit just your precomputed answers (i.e., a program which just prints your output for the input file all.in).
你的程序应输出 q 行。第 i 行应包含对第 i 个问题的回答:若该照片已被重新排列,则输出 YES;否则输出 NO。只要所有答案均符合此格式,且其中至少 75% 正确,即视为通过。
由于输入规模较大,你可自由在本地处理,并仅提交预先计算好的答案(即一个直接针对输入文件 all.in 输出对应结果的程序)。
说明/提示
The link to download all necessary files is http://assets.codeforces.com/files/690/easy_contestant_package.zip
下载所有必要文件的链接为 http://assets.codeforces.com/files/690/easy_contestant_package.zip
输入解题思路,AI测评打分。不知道怎么写?