QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#313982#5446. 琪露诺的符卡交换YeahPotato#20 4ms4008kbC++14936b2024-01-25 11:03:592024-07-04 03:21:24

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 03:21:24]
  • 评测
  • 测评结果:20
  • 用时:4ms
  • 内存:4008kb
  • [2024-01-25 11:03:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int T, n, a[205][205], f, p[205];
int main() {
	cin >> T;
	while (T --) {
		scanf ("%d", &n), f = 1;
		for (int i=1; i<=n; i++)
			for (int j=1; j<=n; j++)
				scanf ("%d", &a[i][j]), f &= a[i][j] == a[i][1];
		if (f) {
			printf ("%d\n", n * (n - 1) >> 1);
			for (int i=n; i; i--)
				for (int j=i-1; j; j--)
					printf ("%d %d %d %d\n", i, j, j, i);
		} else if (n == 2) puts ("0");
		else {
			for (int i=1; i<=n; i++) {
				p[i] = n;
				if (a[i][1] ^ a[i][2])
					p[i] = a[i][1] == a[i][3] ? 2 : 1;
				else for (int j=3; j<=n; j++)
					if (a[i][j-1] ^ a[i][j])
						{ p[i] = j; break; }
			}
			for (int i=1; i<=n; i++)
				if (i ^ p[1])
					printf ("%d %d %d %d\n", 1, i, i + (i < p[1]), p[i+(i<p[1])]);
			for (int i=n; i>2; i--)
				for (int j=i-2; j; j--)
					printf ("%d %d %d %d\n", i, j + (j >= p[i]), j + 1, i - (i <= p[j+1]));
		}
	}
}

详细

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 3ms
memory: 3892kb

input:

7
132
96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 ...

output:

8646
132 131 131 132
132 130 130 132
132 129 129 132
132 128 128 132
132 127 127 132
132 126 126 132
132 125 125 132
132 124 124 132
132 123 123 132
132 122 122 132
132 121 121 132
132 120 120 132
132 119 119 132
132 118 118 132
132 117 117 132
132 116 116 132
132 115 115 132
132 114 114 132
132 113...

result:

ok your solution is correct.

Test #2:

score: 0
Accepted
time: 2ms
memory: 3964kb

input:

8
14
13 13 13 13 13 13 13 13 13 13 13 13 13 13
7 7 7 7 7 7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8 8 8 8 8 8
14 14 14 14 14 14 14 14 14 14 14 14 14 14
5 5 5 5 5 5 5 5 5 5 5 5 5 5
4 4 4 4 4 4 4 4 4 4 4 4 4 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1
10 10 10 10 10 10 10 10 10 10 10 10 10 10
2 2 2 2 2 2 2 2 2 2 2 2 2 2
9...

output:

91
14 13 13 14
14 12 12 14
14 11 11 14
14 10 10 14
14 9 9 14
14 8 8 14
14 7 7 14
14 6 6 14
14 5 5 14
14 4 4 14
14 3 3 14
14 2 2 14
14 1 1 14
13 12 12 13
13 11 11 13
13 10 10 13
13 9 9 13
13 8 8 13
13 7 7 13
13 6 6 13
13 5 5 13
13 4 4 13
13 3 3 13
13 2 2 13
13 1 1 13
12 11 11 12
12 10 10 12
12 9 9 12...

result:

ok your solution is correct.

Test #3:

score: 0
Accepted
time: 2ms
memory: 3872kb

input:

4
82
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...

output:

3321
82 81 81 82
82 80 80 82
82 79 79 82
82 78 78 82
82 77 77 82
82 76 76 82
82 75 75 82
82 74 74 82
82 73 73 82
82 72 72 82
82 71 71 82
82 70 70 82
82 69 69 82
82 68 68 82
82 67 67 82
82 66 66 82
82 65 65 82
82 64 64 82
82 63 63 82
82 62 62 82
82 61 61 82
82 60 60 82
82 59 59 82
82 58 58 82
82 57 5...

result:

ok your solution is correct.

Test #4:

score: 0
Accepted
time: 4ms
memory: 3932kb

input:

8
3
1 1 1
3 3 3
2 2 2
3
1 1 1
3 3 3
2 2 2
1
1
11
5 5 5 5 5 5 5 5 5 5 5
3 3 3 3 3 3 3 3 3 3 3
1 1 1 1 1 1 1 1 1 1 1
9 9 9 9 9 9 9 9 9 9 9
4 4 4 4 4 4 4 4 4 4 4
11 11 11 11 11 11 11 11 11 11 11
2 2 2 2 2 2 2 2 2 2 2
6 6 6 6 6 6 6 6 6 6 6
8 8 8 8 8 8 8 8 8 8 8
10 10 10 10 10 10 10 10 10 10 10
7 7 7 7 7...

output:

3
3 2 2 3
3 1 1 3
2 1 1 2
3
3 2 2 3
3 1 1 3
2 1 1 2
0
55
11 10 10 11
11 9 9 11
11 8 8 11
11 7 7 11
11 6 6 11
11 5 5 11
11 4 4 11
11 3 3 11
11 2 2 11
11 1 1 11
10 9 9 10
10 8 8 10
10 7 7 10
10 6 6 10
10 5 5 10
10 4 4 10
10 3 3 10
10 2 2 10
10 1 1 10
9 8 8 9
9 7 7 9
9 6 6 9
9 5 5 9
9 4 4 9
9 3 3 9
9 2...

result:

ok your solution is correct.

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #5:

score: 0
Wrong Answer
time: 3ms
memory: 4008kb

input:

5
17
9 9 9 9 9 9 9 9 9 9 9 9 9 2 9 9 9
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6
2 2 2 2 2 2 2 2 2 2 2 2 11 2 2 2 2
4 4 4 4 4 4 10 4 4 4 4 4 4 4 4 4 4
10 10 10 10 10 10 8 10 10 10 10 10 10 10 10 10 10
12 12 12 12 12 12 12 12 12 12 12 12 14 12 12 12 12
14 14 14 14 14 14 14 14 14 14 14 12 14 14 14 14 14
16 16...

output:

1 1 2 17
1 2 3 13
1 3 4 7
1 4 5 7
1 5 6 13
1 6 7 12
1 7 8 3
1 8 9 2
1 9 10 9
1 10 11 2
1 11 12 2
1 12 13 3
1 13 14 17
1 15 15 8
1 16 16 14
1 17 17 9
17 16 16 17
17 15 15 17
17 14 14 16
17 13 13 17
17 12 12 17
17 11 11 17
17 10 10 17
17 8 9 17
17 7 8 17
17 6 7 17
17 5 6 17
17 4 5 17
17 3 4 17
17 2 3 ...

result:

wrong answer exist a kind of card which a person don't hold.

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%