Logo
(追記) (追記ここまで)

5497번 - XOR 1 점수다국어언어 제한

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB64031824049.383%

문제

You are implementing an application for a mobile phone, which has a black-and-white screen. The x-coordinates of the screen start from the left and the y-coordinates from the top, as shown in the figures. For the application, you need various images, which are not all of the same size. Instead of storing the images, you want to create the images using the phone’s graphics library. You may assume that at the start of drawing an image, all pixels of the screen are white. The only graphics operation in the phone’s library is XOR(L,R,T,B), which will reverse the pixel values in the rectangle with top left coordinate (L,T) and bottom right coordinate (R,B), where L stands for the left, T for the top, R for the right and B for the bottom coordinate. Note that in some other graphics libraries the order of the arguments is different.

As an example, consider the image in Figure-3. Applying XOR(2,4,2,6) to an all white image gives the image in Figure-1. Applying XOR(3,6,4,7) to the image of Figure-1 gives the image in Figure-2, and applying XOR(1,3,3,5) to the image in Figure-2 finally gives the image in Figure-3

Figure-1 Figure-2 Figure-3

Given a set of black-and-white pictures, your task is to generate each picture from an initially white screen using as few XOR calls as you can. You are given the input files describing the images, and you are to submit files including the required XOR call parameters, not a program to create these files.

입력

You are given 10 problem instances in the text files named xor1.in to xor10.in. Each input file is organized as follows. The first line of an input file contains one integer N, 5 ≤ N ≤ 2000, meaning that there are N rows and N columns in the image. The remaining lines represent the rows of the image from top to bottom. Each line contains N integers: the pixel values in the row from left to right. Each of these integers is either a 0 or a 1, where 0 represents a white pixel and 1 represents a black pixel.

출력

The first line contains an integer K: the number of XOR calls specified in the file. The following K lines represent these calls from the first call to the last call to be executed. Each of these K lines contains four integers: the XOR call parameters L, R, T, B in that order.

제한

점수

If

  • the XOR calls specified in your output file do not generate the required image, or
  • the number of XOR calls specified in your output file is not K, or
  • in your output file, K > 40000, or
  • your output file contains such an XOR call that L > R or T > B, or
  • your output file contains an XOR call which does not have positive coordinates, or
  • your output file contains an XOR call with a coordinate value exceeding N,

then your score is zero. Otherwise, your score is K.

예제 입력 1

7
0 0 0 0 0 0 0
0 1 1 1 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 1 0
1 0 1 0 1 1 0
0 1 0 0 1 1 0
0 0 1 1 1 1 0

예제 출력 1

3
2 4 2 6
3 6 4 7
1 3 3 5

힌트

출처

Olympiad > International Olympiad in Informatics > IOI 2002 > Day 1 3-1번

제출할 수 있는 언어

Text

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 맞힌 사람의 정렬 기준은 점수의 오름차순이다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /