QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#76217#5446. 琪露诺的符卡交换Crysfly100 ✓105ms5640kbC++171.2kb2023-02-08 15:03:012023-02-08 15:03:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-08 15:03:02]
  • 评测
  • 测评结果:100
  • 用时:105ms
  • 内存:5640kb
  • [2023-02-08 15:03:01]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define N 205
#define inf 0x3f3f3f3f

int n,a[N][N],b[N][N];
vi p[N][N]; 

int bel[N];
bitset<N>e[N],nvis;
bool match(int u){
	for(int i=(e[u]&nvis)._Find_first();i!=N;i=(e[u]&nvis)._Find_next(i))
		if(!bel[i]||(nvis.reset(i),match(bel[i]))) return bel[i]=u,1;
	return 0;
}

void work()
{
	n=read();
	For(i,1,n)For(j,1,n)a[i][j]=read(),p[i][a[i][j]].pb(j);
	For(_,1,n){
		For(i,1,n){
			bel[i]=0;
			For(j,1,n)e[i][j]=(p[i][j].size()>0); 
		}
		For(i,1,n) nvis.set(),assert(match(i));
		For(j,1,n){
			int i=bel[j];
			b[i][_]=p[i][j].back(),p[i][j].pop_back();
		}
	}
	cout<<n*(n-1)/2<<"\n";
	For(i,1,n)For(j,1,i-1)printf("%d %d %d %d\n",i,b[i][j],j,b[j][i]);
}

signed main()
{
	int T=read();
	while(T--)work();
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 6ms
memory: 4848kb

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
2 132 1 131
3 132 1 130
3 131 2 130
4 132 1 129
4 131 2 129
4 130 3 129
5 132 1 128
5 131 2 128
5 130 3 128
5 129 4 128
6 132 1 127
6 131 2 127
6 130 3 127
6 129 4 127
6 128 5 127
7 132 1 126
7 131 2 126
7 130 3 126
7 129 4 126
7 128 5 126
7 127 6 126
8 132 1 125
8 131 2 125
8 130 3 125
8 129 4...

result:

ok your solution is correct.

Test #2:

score: 0
Accepted
time: 6ms
memory: 4668kb

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
2 14 1 13
3 14 1 12
3 13 2 12
4 14 1 11
4 13 2 11
4 12 3 11
5 14 1 10
5 13 2 10
5 12 3 10
5 11 4 10
6 14 1 9
6 13 2 9
6 12 3 9
6 11 4 9
6 10 5 9
7 14 1 8
7 13 2 8
7 12 3 8
7 11 4 8
7 10 5 8
7 9 6 8
8 14 1 7
8 13 2 7
8 12 3 7
8 11 4 7
8 10 5 7
8 9 6 7
8 8 7 7
9 14 1 6
9 13 2 6
9 12 3 6
9 11 4 6
9 ...

result:

ok your solution is correct.

Test #3:

score: 0
Accepted
time: 7ms
memory: 4724kb

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
2 82 1 81
3 82 1 80
3 81 2 80
4 82 1 79
4 81 2 79
4 80 3 79
5 82 1 78
5 81 2 78
5 80 3 78
5 79 4 78
6 82 1 77
6 81 2 77
6 80 3 77
6 79 4 77
6 78 5 77
7 82 1 76
7 81 2 76
7 80 3 76
7 79 4 76
7 78 5 76
7 77 6 76
8 82 1 75
8 81 2 75
8 80 3 75
8 79 4 75
8 78 5 75
8 77 6 75
8 76 7 75
9 82 1 74
9 81 ...

result:

ok your solution is correct.

Test #4:

score: 0
Accepted
time: 15ms
memory: 5008kb

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
2 3 1 2
3 3 1 1
3 2 2 1
3
2 3 1 2
3 3 1 1
3 2 2 1
0
55
2 11 1 10
3 11 1 9
3 10 2 9
4 11 1 8
4 10 2 8
4 9 3 8
5 11 1 7
5 10 2 7
5 9 3 7
5 8 4 7
6 11 1 6
6 10 2 6
6 9 3 6
6 8 4 6
6 7 5 6
7 11 1 5
7 10 2 5
7 9 3 5
7 8 4 5
7 7 5 5
7 6 6 5
8 11 1 4
8 10 2 4
8 9 3 4
8 8 4 4
8 7 5 4
8 6 6 4
8 5 7 4
9 11 ...

result:

ok your solution is correct.

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #5:

score: 20
Accepted
time: 7ms
memory: 4904kb

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:

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

result:

ok your solution is correct.

Test #6:

score: 0
Accepted
time: 6ms
memory: 4860kb

input:

9
1
1
28
2 2 2 2 5 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
7 24 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 8 13 13 13
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 16 8 8 8 8 8 8 8 8 8 8 8 8
17 24 24 24 24 24 24 24 24 24 24 24 24...

output:

0
378
2 2 1 28
3 25 1 27
3 28 2 27
4 16 1 26
4 28 2 26
4 27 3 26
5 1 1 25
5 28 2 25
5 27 3 24
5 26 4 25
6 9 1 24
6 28 2 24
6 27 3 23
6 26 4 24
6 25 5 24
7 1 1 23
7 28 2 23
7 27 3 22
7 26 4 23
7 25 5 23
7 24 6 23
8 11 1 22
8 28 2 22
8 27 3 21
8 26 4 22
8 25 5 22
8 24 6 22
8 23 7 22
9 3 1 21
9 28 2 21...

result:

ok your solution is correct.

Test #7:

score: 0
Accepted
time: 5ms
memory: 4776kb

input:

9
22
19 19 19 19 19 19 19 19 19 10 19 19 19 19 19 19 19 19 19 19 19 19
17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 8
21 21 21 21 21 21 21 21 5 21 21 21 21 21 21 21 21 21 21 21 21 21
12 12 12 12 12 12 12 22 12 12 12 12 12 12 12 12 12 12 12 12 12 12
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...

output:

231
2 21 1 21
3 22 1 20
3 21 2 19
4 8 1 19
4 22 2 18
4 21 3 19
5 22 1 18
5 20 2 17
5 19 3 18
5 18 4 19
6 22 1 17
6 21 2 16
6 20 3 17
6 19 4 18
6 18 5 16
7 22 1 16
7 21 2 15
7 20 3 16
7 19 4 17
7 18 5 15
7 17 6 16
8 21 1 15
8 22 2 14
8 20 3 15
8 19 4 16
8 18 5 14
8 17 6 15
8 16 7 15
9 22 1 14
9 21 2 ...

result:

ok your solution is correct.

Test #8:

score: 0
Accepted
time: 6ms
memory: 4868kb

input:

8
29
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6 3 3 3 3
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 3 11 11 11 11 11 11 11 11
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 1 1 1 1 1 1 1
20 20 20 20 20 20 20 20 20 20 20 25 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
26 26...

output:

406
2 21 1 29
3 22 1 28
3 29 2 28
4 12 1 27
4 29 2 27
4 28 3 27
5 20 1 26
5 29 2 26
5 28 3 26
5 27 4 26
6 7 1 24
6 29 2 25
6 28 3 25
6 27 4 25
6 26 5 25
7 11 1 23
7 29 2 24
7 28 3 24
7 27 4 24
7 26 5 24
7 25 6 24
8 9 1 22
8 29 2 23
8 28 3 23
8 27 4 23
8 26 5 23
8 25 6 23
8 24 7 23
9 29 1 21
9 28 2 2...

result:

ok your solution is correct.

Subtask #3:

score: 60
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #9:

score: 60
Accepted
time: 3ms
memory: 4536kb

input:

19
1
1
2
1 2
1 2
3
1 3 2
2 3 1
2 1 3
4
1 4 3 4
3 2 2 1
3 1 2 3
4 4 1 2
5
4 2 1 5 4
4 5 4 4 1
5 3 2 3 2
3 1 3 2 1
3 1 2 5 5
6
6 2 2 1 6 6
2 5 5 3 4 6
1 2 4 2 6 1
4 4 1 4 5 1
1 2 6 5 3 5
5 3 3 3 3 4
7
5 2 3 6 4 2 7
2 1 6 1 1 5 2
1 6 7 7 5 1 2
6 6 3 4 4 7 1
3 6 5 7 3 2 7
3 2 5 1 4 5 4
5 3 3 7 4 4 6
8
1...

output:

0
1
2 1 1 1
3
2 1 1 1
3 2 1 3
3 1 2 3
6
2 1 1 2
3 3 1 3
3 4 2 3
4 3 1 1
4 4 2 2
4 2 3 1
10
2 2 1 3
3 4 1 4
3 1 2 3
4 4 1 2
4 3 2 1
4 5 3 2
5 2 1 1
5 3 2 5
5 1 3 3
5 5 4 1
15
2 1 1 5
3 6 1 1
3 4 2 3
4 4 1 4
4 6 2 2
4 2 3 5
5 6 1 3
5 4 2 6
5 1 3 1
5 2 4 5
6 5 1 2
6 4 2 4
6 3 3 3
6 2 4 3
6 6 5 3
21
2 6...

result:

ok your solution is correct.

Test #10:

score: 0
Accepted
time: 0ms
memory: 4540kb

input:

19
1
1
2
2 1
1 2
3
2 1 2
3 3 3
1 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 1 1
3 4 2 4
4 3 1 3
4 2 2 3
4 1 3 1
5 2 1 2
5 5 2 2
5 3 3 2
5 4 4 4
15
2 6 1 2
3 6 1 6
3 5 2 2
4 5 1 5
4 3 2 1
4 2 3 2
5 4 1 4
5 6 2 5
5 1 3 1
5 5 4 1
6 6 1 1
6 3 2 3
6 2 3 4
6 4 4 4
6 5 5 2
21
2 1...

result:

ok your solution is correct.

Test #12:

score: 0
Accepted
time: 0ms
memory: 4700kb

input:

19
1
1
2
2 2
1 1
3
1 1 2
2 1 3
3 2 3
4
2 1 2 3
2 1 3 3
4 4 4 4
2 3 1 1
5
3 5 5 5 4
1 4 4 5 2
1 1 3 1 5
2 4 3 2 3
2 3 4 1 2
6
5 5 4 3 1 1
3 4 1 6 6 6
6 2 2 1 4 4
2 2 6 5 3 3
1 5 6 2 3 3
5 4 1 2 4 5
7
6 4 4 7 7 5 6
1 1 2 1 4 2 7
5 2 5 3 1 1 2
3 4 2 7 6 7 6
5 6 1 2 7 6 4
5 6 5 3 3 7 3
5 4 2 1 3 4 3
8
2...

output:

0
1
2 2 1 1
3
2 3 1 3
3 2 1 1
3 3 2 1
6
2 1 1 3
3 4 1 2
3 3 2 3
4 4 1 1
4 3 2 2
4 1 3 1
10
2 5 1 4
3 5 1 3
3 4 2 1
4 5 1 2
4 3 2 2
4 2 3 2
5 4 1 1
5 5 2 4
5 1 3 1
5 2 4 1
15
2 1 1 3
3 6 1 1
3 4 2 3
4 3 1 6
4 4 2 5
4 2 3 3
5 4 1 4
5 6 2 4
5 5 3 5
5 2 4 1
6 3 1 5
6 4 2 2
6 5 3 2
6 2 4 5
6 6 5 3
21
2 6...

result:

ok your solution is correct.

Test #13:

score: 0
Accepted
time: 11ms
memory: 5148kb

input:

5
156
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 95 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 34 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 130 1 42 1 1 1 1 1 1 1 1 1 1 1 1 90 1 64 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

12090
2 3 1 122
3 111 1 109
3 50 2 156
4 79 1 26
4 156 2 155
4 100 3 20
5 156 1 156
5 80 2 6
5 37 3 86
5 71 4 106
6 48 1 155
6 26 2 39
6 87 3 96
6 92 4 155
6 31 5 154
7 56 1 84
7 91 2 145
7 90 3 123
7 134 4 125
7 152 5 146
7 80 6 119
8 69 1 154
8 108 2 91
8 39 3 156
8 53 4 62
8 131 5 8
8 112 6 77
8 ...

result:

ok your solution is correct.

Test #14:

score: 0
Accepted
time: 3ms
memory: 5012kb

input:

7
2
1 2
1 2
4
1 4 4 1
2 3 2 4
1 4 3 3
3 1 2 2
39
1 31 38 1 22 35 1 32 36 19 33 1 1 1 4 14 24 35 33 4 1 31 34 1 1 27 1 1 34 8 35 1 1 38 10 1 6 8 10
22 14 2 2 2 20 9 26 2 8 26 23 2 36 36 2 38 2 2 18 27 29 3 28 2 3 31 33 36 2 20 2 11 33 32 2 2 2 32
34 39 11 34 35 3 3 3 16 3 3 3 34 39 3 27 17 30 33 11 3...

output:

1
2 1 1 1
6
2 3 1 2
3 4 1 4
3 1 2 4
4 2 1 1
4 4 2 1
4 3 3 2
741
2 27 1 22
3 29 1 2
3 32 2 29
4 29 1 18
4 7 2 35
4 34 3 14
5 12 1 8
5 14 2 24
5 33 3 35
5 19 4 16
6 11 1 10
6 23 2 15
6 19 3 2
6 6 4 27
6 25 5 29
7 38 1 34
7 18 2 11
7 10 3 22
7 35 4 1
7 24 5 6
7 12 6 33
8 35 1 3
8 36 2 14
8 26 3 19
8 4 ...

result:

ok your solution is correct.

Test #15:

score: 0
Accepted
time: 12ms
memory: 4964kb

input:

7
9
3 8 8 5 7 7 2 5 2
5 9 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
6 8 3 3
6 5 4 2
6 3 5 8
7 6 1 6
7 3 2 1
7 7 3 7
7 5 4 8
7 8 5 3
7 4 6 2
8 5 1 5
8 4 2 3
8 8 3 1
8 2 4 6
8 7 5 2
8 6 6 1
8 3 7 1
15
2 4 1 1
3 1 1 3
3 6 2 1
4 2 1 5
4 4 2 6
4 5 3 5
5 3 1 6
5 2 2 5
5 1 3 ...

result:

ok your solution is correct.

Test #17:

score: 0
Accepted
time: 105ms
memory: 5640kb

input:

1
200
10 98 86 3 124 117 19 6 74 143 48 196 32 33 15 5 23 56 138 65 150 46 125 157 43 162 48 141 161 93 179 175 163 1 144 183 105 65 158 195 102 112 69 194 142 177 182 135 60 77 140 117 47 171 5 157 14 115 17 163 130 55 134 74 10 108 117 181 75 154 14 138 106 60 127 25 162 196 172 156 66 41 20 127 1...

output:

19900
2 18 1 40
3 183 1 143
3 169 2 188
4 169 1 79
4 140 2 72
4 144 3 61
5 98 1 180
5 179 2 161
5 168 3 166
5 108 4 24
6 109 1 125
6 101 2 139
6 33 3 160
6 122 4 159
6 68 5 145
7 110 1 157
7 63 2 92
7 200 3 76
7 131 4 7
7 162 5 63
7 174 6 46
8 143 1 78
8 177 2 90
8 22 3 193
8 189 4 92
8 127 5 45
8 9...

result:

ok your solution is correct.

Test #18:

score: 0
Accepted
time: 96ms
memory: 5632kb

input:

1
200
42 73 47 35 98 195 170 82 124 40 112 112 80 136 155 167 74 76 68 175 89 120 162 78 36 65 58 93 75 42 173 84 148 52 29 59 10 32 34 87 101 176 48 36 139 197 170 149 77 157 122 68 96 95 190 130 97 125 36 4 107 61 174 121 48 166 103 182 96 96 128 200 44 188 32 1 196 61 141 123 153 18 181 199 101 5...

output:

19900
2 135 1 140
3 77 1 137
3 129 2 101
4 108 1 186
4 28 2 86
4 140 3 150
5 104 1 77
5 193 2 50
5 77 3 80
5 192 4 67
6 53 1 91
6 188 2 73
6 51 3 196
6 156 4 112
6 95 5 180
7 129 1 92
7 198 2 83
7 106 3 63
7 69 4 152
7 88 5 196
7 24 6 193
8 83 1 93
8 147 2 130
8 127 3 39
8 144 4 177
8 100 5 73
8 41 ...

result:

ok your solution is correct.

Test #19:

score: 0
Accepted
time: 100ms
memory: 5620kb

input:

1
200
50 94 96 46 14 72 8 114 112 20 65 181 26 198 1 48 129 163 61 44 64 53 39 18 119 183 32 138 194 35 14 24 117 21 136 59 136 63 55 177 106 7 192 127 139 41 171 171 143 62 74 134 110 125 74 197 23 173 159 165 178 70 99 68 42 5 68 172 179 34 38 47 196 194 115 83 20 128 156 79 4 90 151 133 107 164 8...

output:

19900
2 167 1 40
3 53 1 43
3 162 2 90
4 159 1 69
4 187 2 172
4 58 3 52
5 150 1 189
5 187 2 191
5 141 3 77
5 153 4 156
6 161 1 91
6 33 2 136
6 137 3 78
6 87 4 125
6 129 5 90
7 91 1 112
7 102 2 55
7 42 3 170
7 155 4 29
7 14 5 132
7 92 6 188
8 163 1 200
8 61 2 39
8 120 3 101
8 14 4 69
8 176 5 95
8 174 ...

result:

ok your solution is correct.

Test #20:

score: 0
Accepted
time: 29ms
memory: 5108kb

input:

1
200
1 1 1 1 1 1 1 1 169 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 99 1 196 90 1 1 1 1 1 83 174 1 1 1 83 1 1 73 1 59 1 153 1 1 1 1 1 1 1 1 1 1 28 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 175 1 1 1 1 1 1 1 63 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 102 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 37 1 1...

output:

19900
2 100 1 44
3 39 1 199
3 57 2 64
4 76 1 152
4 82 2 54
4 145 3 95
5 199 1 135
5 119 2 68
5 198 3 46
5 187 4 181
6 47 1 39
6 199 2 133
6 165 3 48
6 200 4 25
6 148 5 197
7 105 1 188
7 64 2 105
7 54 3 60
7 81 4 128
7 156 5 181
7 159 6 48
8 77 1 25
8 56 2 13
8 190 3 89
8 128 4 199
8 19 5 124
8 44 6 ...

result:

ok your solution is correct.

Extra Test:

score: 0
Extra Test Passed