CF690E1.Photographs (I)

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

The Human-Cow Confederation ( HC2HC^{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 7575% 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.

输入格式

The first line of the input contains the number qq of questions ( 1<=q<=2201<=q<=220 ). After that, qq questions follow, each of which in the format described below.

The first line of every question contains two space-separated integers hh and ww ( 1<=h,w<=6001<=h,w<=600 ) – the height (number of rows) and width (number of columns) of the photograph. (Most photographs are roughly 200×300200×300 .) After this, hh lines follow, each describing a single row of the picture. The picture is monochrome (in shades of grey). Its ii -th row is described by ww space-separated integers aija_{ij} ( j=1,...,wj=1,...,w ), where aija_{ij} is the brightness of the corresponding pixel ( 0<=aij<2560<=a_{ij}<256 , where 00 is black and 255255 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 hh 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 2020 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 2020 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

首页