#A. 小数独验证

    Type: Default 1000ms 256MiB

小数独验证

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

33DAI 最近在玩一个 4x44x4 的小数独。这个数独可以看作是一个 4444 列的小数组。

a1,1,a1,2a1,3,a1,4a2,1,a2,2a2,3,a2,4+a3,1,a3,2a3,3,a3,4a4,1,a4,2a4,3,a4,4a_{1,1},a_{1,2}|a_{1,3},a_{1,4}\\ a_{2,1},a_{2,2}|a_{2,3},a_{2,4}\\ ----+----\\ a_{3,1},a_{3,2}|a_{3,3},a_{3,4}\\ a_{4,1},a_{4,2}|a_{4,3},a_{4,4}\\

当下面六个条件都成立时,我们认为这个数独是合法的:

  1. 每一行都是由 141\sim 4 构成的
  2. 每一列都是由 141\sim 4 构成的
  3. 左上方四个数 a1,1,a1,2,a2,1,a2,2a_{1,1},a_{1,2},a_{2,1},a_{2,2} 是由 141\sim 4 构成的
  4. 右上方四个数 a1,3,a1,4,a2,3,a2,4a_{1,3},a_{1,4},a_{2,3},a_{2,4} 是由 141\sim 4 构成的
  5. 左下方四个数 a3,1,a3,2,a4,1,a4,2a_{3,1},a_{3,2},a_{4,1},a_{4,2} 是由 141\sim 4 构成的
  6. 右下方四个数 a3,3,a3,4,a4,3,a4,4a_{3,3},a_{3,4},a_{4,3},a_{4,4} 是由 141\sim 4 构成的

现在给你 33DAI 填完的结果,请你判断他填的是否合法。

输入格式

四行四列,输出 33DAI 填好的数独。

输出格式

一行一个字符串,如果合法就输出 yes,否则输出 no

4 2 3 1
1 3 2 4
3 4 1 2
2 1 4 3
yes
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
no

数据规模与约定

对于 100%100\% 的数据,1ai,j41\le a_{i,j} \le 4

  • 子任务 1(1 分):保证六个条件都成立。
  • 子任务 2(99 分):没有特殊限制。

注意:本题赛后可能会加强数据并重测

C++校统测三

Not Attended
Status
Done
Rule
Ledo
Problem
7
Start at
2024-12-22 9:45
End at
2024-12-30 17:45
Duration
200 hour(s)
Host
Partic.
8