-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_Chess_Tournament.cpp
More file actions
72 lines (71 loc) · 1.77 KB
/
B_Chess_Tournament.cpp
File metadata and controls
72 lines (71 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1000000;
vector<bool> p(MAXN, true);
int main()
{
ll t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
string s;
cin >> s;
ll x = 0;
for (ll i = 0; i < s.size(); i++)
{
if (s[i] == '2')
x++;
}
if (x == 1 || x == 2)
cout << "NO\n";
else
{
char arr[n + 2][n + 2];
cout << "YES\n";
for (ll i = 0; i < n; i++)
{
for (ll j = 0; j < n; j++)
if (i == j)
{
arr[i][j] = 'X';
continue;
}
}
for (ll i = 0; i < n; i++)
{
ll c = 0;
for (ll j = i + 1; j < n; j++)
{
if (s[i] == '1' || s[j] == '1')
{
arr[i][j] = '=';
arr[j][i] = '=';
}
// else if (i == j)
// arr[i][j] = 'X';
else if (s[i] == '2' && c == 0)
{
arr[i][j] = '+';
arr[j][i] = '-';
c = 1;
}
else
{
arr[i][j] = '-';
arr[j][i] = '+';
}
}
}
for (ll i = 0; i < n; i++)
{
for (ll j = 0; j < n; j++)
cout << arr[i][j];
cout << endl;
}
// cout << endl;
}
}
}