Submission #1039035

# Submission time Handle Problem Language Result Execution time Memory
1039035 2024-07-30T11:06:08 Z Unforgettablepl Table Tennis (JOI24_tabletennis) C++17
4 / 100
816 ms 616 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

void solve(){
	int n,m;
	cin >> n >> m;
	int edges = (n*(n-1))/2;
	auto test = [&](int x){
		vector<vector<bool>> wins(n+1,vector<bool>(n+1));
		int idx = 0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<i;j++){
				wins[i][j]=x&(1<<(idx++));
			}
		}
		int curr = 0;
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				for(int k=j+1;k<=n;k++){
					if(wins[j][i]==wins[k][j] and wins[k][j]!=wins[k][i])curr++;
				}
			}
		}
		if(curr==m){
			cout << "Yes\n";
			for(int i=2;i<=n;i++){
				for(int j=1;j<i;j++){
					if(wins[i][j])cout<<'1';
					else cout<<'0';
				}
				cout << '\n';
			}
			return true;
		}
		return false;
	};
	for(int mask=0;mask<(1<<edges);mask++){
		if(test(mask))return;
	}
	cout << "No\n";
}


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int q;
	cin >> q;
	while(q--)solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 8 ms 524 KB User answer is No, but jury answer is Yes
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 14 ms 448 KB Output is correct
21 Correct 0 ms 360 KB Output is correct
22 Correct 0 ms 452 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 11 ms 348 KB Output is correct
28 Correct 816 ms 432 KB Output is correct
29 Correct 1 ms 616 KB Output is correct
30 Correct 11 ms 452 KB Output is correct
31 Correct 12 ms 452 KB Output is correct
32 Correct 741 ms 592 KB Output is correct
33 Correct 770 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 11 ms 348 KB Output is correct
37 Correct 770 ms 428 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 93 ms 348 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 17 ms 348 KB Output is correct
52 Correct 15 ms 344 KB Output is correct
53 Correct 41 ms 348 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 14 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 11 ms 468 KB Output is correct
59 Correct 806 ms 360 KB Output is correct
60 Correct 1 ms 360 KB Output is correct
61 Correct 0 ms 360 KB Output is correct
62 Correct 1 ms 464 KB Output is correct
63 Correct 1 ms 360 KB Output is correct
64 Correct 2 ms 360 KB Output is correct
65 Correct 0 ms 396 KB Output is correct
66 Correct 0 ms 360 KB Output is correct
67 Correct 1 ms 360 KB Output is correct
68 Correct 1 ms 360 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 0 ms 360 KB Output is correct
71 Correct 0 ms 360 KB Output is correct
72 Correct 0 ms 360 KB Output is correct
73 Correct 0 ms 360 KB Output is correct
74 Correct 0 ms 360 KB Output is correct
75 Correct 0 ms 360 KB Output is correct
76 Correct 0 ms 360 KB Output is correct
77 Correct 0 ms 360 KB Output is correct
78 Correct 0 ms 360 KB Output is correct
79 Correct 0 ms 360 KB Output is correct
80 Correct 0 ms 360 KB Output is correct
81 Correct 0 ms 360 KB Output is correct
82 Correct 95 ms 360 KB Output is correct
83 Correct 2 ms 348 KB Output is correct
84 Correct 14 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 14 ms 448 KB Output is correct
21 Correct 0 ms 360 KB Output is correct
22 Correct 0 ms 452 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 11 ms 348 KB Output is correct
28 Correct 816 ms 432 KB Output is correct
29 Correct 1 ms 616 KB Output is correct
30 Correct 11 ms 452 KB Output is correct
31 Correct 12 ms 452 KB Output is correct
32 Correct 741 ms 592 KB Output is correct
33 Correct 770 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 11 ms 348 KB Output is correct
37 Correct 770 ms 428 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 93 ms 348 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 17 ms 348 KB Output is correct
52 Correct 15 ms 344 KB Output is correct
53 Correct 41 ms 348 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 14 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 11 ms 468 KB Output is correct
59 Correct 806 ms 360 KB Output is correct
60 Correct 1 ms 360 KB Output is correct
61 Correct 0 ms 360 KB Output is correct
62 Correct 1 ms 464 KB Output is correct
63 Correct 1 ms 360 KB Output is correct
64 Correct 2 ms 360 KB Output is correct
65 Correct 0 ms 396 KB Output is correct
66 Correct 0 ms 360 KB Output is correct
67 Correct 1 ms 360 KB Output is correct
68 Correct 1 ms 360 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 0 ms 360 KB Output is correct
71 Correct 0 ms 360 KB Output is correct
72 Correct 0 ms 360 KB Output is correct
73 Correct 0 ms 360 KB Output is correct
74 Correct 0 ms 360 KB Output is correct
75 Correct 0 ms 360 KB Output is correct
76 Correct 0 ms 360 KB Output is correct
77 Correct 0 ms 360 KB Output is correct
78 Correct 0 ms 360 KB Output is correct
79 Correct 0 ms 360 KB Output is correct
80 Correct 0 ms 360 KB Output is correct
81 Correct 0 ms 360 KB Output is correct
82 Correct 95 ms 360 KB Output is correct
83 Correct 2 ms 348 KB Output is correct
84 Correct 14 ms 456 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Incorrect 8 ms 452 KB User answer is No, but jury answer is Yes
88 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 14 ms 448 KB Output is correct
21 Correct 0 ms 360 KB Output is correct
22 Correct 0 ms 452 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 11 ms 348 KB Output is correct
28 Correct 816 ms 432 KB Output is correct
29 Correct 1 ms 616 KB Output is correct
30 Correct 11 ms 452 KB Output is correct
31 Correct 12 ms 452 KB Output is correct
32 Correct 741 ms 592 KB Output is correct
33 Correct 770 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 11 ms 348 KB Output is correct
37 Correct 770 ms 428 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 93 ms 348 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 17 ms 348 KB Output is correct
52 Correct 15 ms 344 KB Output is correct
53 Correct 41 ms 348 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 14 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 11 ms 468 KB Output is correct
59 Correct 806 ms 360 KB Output is correct
60 Correct 1 ms 360 KB Output is correct
61 Correct 0 ms 360 KB Output is correct
62 Correct 1 ms 464 KB Output is correct
63 Correct 1 ms 360 KB Output is correct
64 Correct 2 ms 360 KB Output is correct
65 Correct 0 ms 396 KB Output is correct
66 Correct 0 ms 360 KB Output is correct
67 Correct 1 ms 360 KB Output is correct
68 Correct 1 ms 360 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 0 ms 360 KB Output is correct
71 Correct 0 ms 360 KB Output is correct
72 Correct 0 ms 360 KB Output is correct
73 Correct 0 ms 360 KB Output is correct
74 Correct 0 ms 360 KB Output is correct
75 Correct 0 ms 360 KB Output is correct
76 Correct 0 ms 360 KB Output is correct
77 Correct 0 ms 360 KB Output is correct
78 Correct 0 ms 360 KB Output is correct
79 Correct 0 ms 360 KB Output is correct
80 Correct 0 ms 360 KB Output is correct
81 Correct 0 ms 360 KB Output is correct
82 Correct 95 ms 360 KB Output is correct
83 Correct 2 ms 348 KB Output is correct
84 Correct 14 ms 456 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Incorrect 8 ms 452 KB User answer is No, but jury answer is Yes
88 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 456 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 14 ms 448 KB Output is correct
21 Correct 0 ms 360 KB Output is correct
22 Correct 0 ms 452 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 11 ms 348 KB Output is correct
28 Correct 816 ms 432 KB Output is correct
29 Correct 1 ms 616 KB Output is correct
30 Correct 11 ms 452 KB Output is correct
31 Correct 12 ms 452 KB Output is correct
32 Correct 741 ms 592 KB Output is correct
33 Correct 770 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 11 ms 348 KB Output is correct
37 Correct 770 ms 428 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 93 ms 348 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 17 ms 348 KB Output is correct
52 Correct 15 ms 344 KB Output is correct
53 Correct 41 ms 348 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 14 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 11 ms 468 KB Output is correct
59 Correct 806 ms 360 KB Output is correct
60 Correct 1 ms 360 KB Output is correct
61 Correct 0 ms 360 KB Output is correct
62 Correct 1 ms 464 KB Output is correct
63 Correct 1 ms 360 KB Output is correct
64 Correct 2 ms 360 KB Output is correct
65 Correct 0 ms 396 KB Output is correct
66 Correct 0 ms 360 KB Output is correct
67 Correct 1 ms 360 KB Output is correct
68 Correct 1 ms 360 KB Output is correct
69 Correct 1 ms 468 KB Output is correct
70 Correct 0 ms 360 KB Output is correct
71 Correct 0 ms 360 KB Output is correct
72 Correct 0 ms 360 KB Output is correct
73 Correct 0 ms 360 KB Output is correct
74 Correct 0 ms 360 KB Output is correct
75 Correct 0 ms 360 KB Output is correct
76 Correct 0 ms 360 KB Output is correct
77 Correct 0 ms 360 KB Output is correct
78 Correct 0 ms 360 KB Output is correct
79 Correct 0 ms 360 KB Output is correct
80 Correct 0 ms 360 KB Output is correct
81 Correct 0 ms 360 KB Output is correct
82 Correct 95 ms 360 KB Output is correct
83 Correct 2 ms 348 KB Output is correct
84 Correct 14 ms 456 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Incorrect 8 ms 452 KB User answer is No, but jury answer is Yes
88 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 8 ms 524 KB User answer is No, but jury answer is Yes
3 Halted 0 ms 0 KB -