QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#315045#895. ColorzltAC ✓49ms8024kbC++143.8kb2024-01-26 20:33:452024-01-26 20:33:46

Judging History

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

  • [2024-01-26 20:33:46]
  • 评测
  • 测评结果:AC
  • 用时:49ms
  • 内存:8024kb
  • [2024-01-26 20:33:45]
  • 提交

answer

#include <bits/stdc++.h>
#define pb emplace_back
#define fst first
#define scd second
#define mkp make_pair
#define mems(a, x) memset((a), (x), sizeof(a))

using namespace std;
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;
typedef pair<ll, ll> pii;

const int maxn = 1010;
const int maxm = 1000100;
const int inf = 0x3f3f3f3f;

int n, m, a[maxn][maxn], b[maxn][maxn], c[maxn][maxn];
int id[maxn][2], head[maxn], len, S, T, nt;

struct edge {
	int to, next, cap, flow;
} edges[maxm];

inline void add_edge(int u, int v, int c, int f) {
	edges[++len].to = v;
	edges[len].next = head[u];
	edges[len].cap = c;
	edges[len].flow = f;
	head[u] = len;
}

struct Dinic {
	int d[maxn], cur[maxn];
	bool vis[maxn];
	
	inline void add(int u, int v, int c) {
		add_edge(u, v, c, 0);
		add_edge(v, u, 0, 0);
	}
	
	inline bool bfs() {
		for (int i = 1; i <= nt; ++i) {
			vis[i] = 0;
			d[i] = -1;
		}
		queue<int> q;
		q.push(S);
		vis[S] = 1;
		d[S] = 0;
		while (q.size()) {
			int u = q.front();
			q.pop();
			for (int i = head[u]; i; i = edges[i].next) {
				edge &e = edges[i];
				if (!vis[e.to] && e.cap > e.flow) {
					vis[e.to] = 1;
					d[e.to] = d[u] + 1;
					q.push(e.to);
				}
			}
		}
		return vis[T];
	}
	
	int dfs(int u, int a) {
		if (u == T || !a) {
			return a;
		}
		int flow = 0, f;
		for (int &i = cur[u]; i; i = edges[i].next) {
			edge &e = edges[i];
			if (d[e.to] == d[u] + 1 && (f = dfs(e.to, min(a, e.cap - e.flow))) > 0) {
				e.flow += f;
				edges[i ^ 1].flow -= f;
				flow += f;
				a -= f;
				if (!a) {
					break;
				}
			}
		}
		return flow;
	}
	
	inline int solve() {
		int flow = 0;
		while (bfs()) {
			for (int i = 1; i <= nt; ++i) {
				cur[i] = head[i];
			}
			flow += dfs(S, inf);
		}
		return flow;
	}
} solver;

int c0[maxn], c1[maxn], c2[maxn];

void solve() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			scanf("%d", &a[i][j]);
			b[i][j] = a[i][j];
			++c[i][a[i][j]];
			++c[j][a[i][j]];
			++c2[a[i][j]];
		}
	}
	if (m % 2 == 0) {
		puts("No");
		return;
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			if (c[i][j] > 1) {
				puts("No");
				return;
			}
		}
	}
	for (int i = 1; i <= m; ++i) {
		c1[i] = n - c2[i] * 2;
		c0[i] = (m + 1 - c2[i] * 2 - c1[i] * 2) / 2;
		if (c1[i] + c2[i] > (m + 1) / 2) {
			puts("No");
			return;
		}
	}
	for (int t = n + 1; t <= m + 1; ++t) {
		for (int i = 1; i <= nt; ++i) {
			head[i] = 0;
		}
		nt = 0;
		len = 1;
		S = ++nt;
		T = ++nt;
		for (int i = 1; i <= m; ++i) {
			id[i][0] = ++nt;
		}
		for (int i = 1; i <= t; ++i) {
			id[i][1] = ++nt;
		}
		for (int i = 1; i <= m; ++i) {
			solver.add(S, id[i][0], 1);
		}
		for (int i = 1; i < t; ++i) {
			solver.add(id[i][1], T, 1);
		}
		solver.add(id[t][1], T, m - t + 1);
		for (int i = 1; i <= m; ++i) {
			for (int j = 1; j < t; ++j) {
				if (!c[j][i]) {
					solver.add(id[i][0], id[j][1], 1);
				}
			}
		}
		for (int i = 1; i <= m; ++i) {
			solver.add(id[i][0], id[t][1], c0[i] * 2);
		}
		solver.solve();
		for (int i = 1; i <= m; ++i) {
			int u = id[i][0];
			bool fl = 0;
			for (int _ = head[u]; _; _ = edges[_].next) {
				edge &e = edges[_];
				if (e.to >= m + 3 && e.to < m + t + 2 && e.flow) {
					int j = e.to - m - 2;
					c[j][i] = c[t][i] = 1;
					b[j][t] = i;
					fl = 1;
				}
			}
			if (fl) {
				--c1[i];
				++c2[i];
			} else {
				--c0[i];
				++c1[i];
			}
		}
	}
	puts("Yes");
	for (int i = 1; i <= m + 1; ++i) {
		for (int j = i + 1; j <= m + 1; ++j) {
			printf("%d ", b[i][j]);
		}
		putchar('\n');
	}
}

int main() {
	int T = 1;
	// scanf("%d", &T);
	while (T--) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5896kb

input:

3 5
1 2
4

output:

Yes
1 2 4 3 5 
4 3 5 2 
5 1 3 
2 1 
4 


result:

ok ok

Test #2:

score: 0
Accepted
time: 1ms
memory: 5732kb

input:

4 5
1 2 3
3 2
1

output:

No

result:

ok ok

Test #3:

score: 0
Accepted
time: 1ms
memory: 5724kb

input:

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

output:

No

result:

ok ok

Test #4:

score: 0
Accepted
time: 1ms
memory: 5900kb

input:

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

output:

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


result:

ok ok

Test #5:

score: 0
Accepted
time: 1ms
memory: 5928kb

input:

3 9
2 8
4

output:

Yes
2 8 9 1 4 3 5 6 7 
4 1 3 9 5 6 7 8 
3 2 5 1 7 9 6 
4 6 7 2 8 5 
7 6 8 5 9 
8 1 3 2 
9 2 4 
4 3 
1 


result:

ok ok

Test #6:

score: 0
Accepted
time: 1ms
memory: 5764kb

input:

8 9
8 3 6 9 2 5 7
2 3 1 7 9 5
7 8 6 4 9
4 5 8 2
3 2 6
1 4
3

output:

No

result:

ok ok

Test #7:

score: 0
Accepted
time: 1ms
memory: 6204kb

input:

5 9
2 7 3 8
6 8 4
2 9
1

output:

Yes
2 7 3 8 9 4 1 6 5 
6 8 4 1 3 9 5 7 
2 9 3 1 5 8 4 
1 4 5 6 7 9 
5 6 7 3 2 
7 8 2 6 
2 9 8 
4 3 
1 


result:

ok ok

Test #8:

score: 0
Accepted
time: 1ms
memory: 5928kb

input:

2 9
6

output:

Yes
6 1 2 8 3 9 4 7 5 
2 1 3 9 8 5 4 7 
3 9 8 4 7 5 6 
4 5 7 6 8 9 
7 5 1 6 2 
6 2 1 4 
3 2 1 
9 8 
3 


result:

ok ok

Test #9:

score: 0
Accepted
time: 1ms
memory: 5868kb

input:

7 7
2 5 6 1 7 4
7 5 6 4 3
3 2 1 6
4 2 1
3 7
5

output:

Yes
2 5 6 1 7 4 3 
7 5 6 4 3 1 
3 2 1 6 4 
4 2 1 7 
3 7 5 
5 6 
2 


result:

ok ok

Test #10:

score: 0
Accepted
time: 1ms
memory: 6136kb

input:

7 7
2 4 5 6 1 7
3 4 5 6 1
6 1 7 2
7 2 3
3 4
5

output:

Yes
2 4 5 6 1 7 3 
3 4 5 6 1 7 
6 1 7 2 5 
7 2 3 1 
3 4 2 
5 4 
6 


result:

ok ok

Test #11:

score: 0
Accepted
time: 1ms
memory: 5952kb

input:

4 11
1 3 9
9 4
7

output:

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


result:

ok ok

Test #12:

score: 0
Accepted
time: 1ms
memory: 5968kb

input:

1 11

output:

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


result:

ok ok

Test #13:

score: 0
Accepted
time: 39ms
memory: 7716kb

input:

82 199
70 77 112 105 155 100 170 32 185 179 197 164 145 63 166 50 160 30 88 196 2 64 144 42 35 96 27 85 128 44 54 110 175 80 21 154 189 125 86 74 131 106 19 114 18 133 40 13 184 82 89 135 182 117 59 92 137 14 188 20 95 121 183 130 11 46 113 156 153 65 199 56 194 123 52 51 36 49 5 24 34
49 84 77 127 ...

output:

Yes
70 77 112 105 155 100 170 32 185 179 197 164 145 63 166 50 160 30 88 196 2 64 144 42 35 96 27 85 128 44 54 110 175 80 21 154 189 125 86 74 131 106 19 114 18 133 40 13 184 82 89 135 182 117 59 92 137 14 188 20 95 121 183 130 11 46 113 156 153 65 199 56 194 123 52 51 36 49 5 24 34 198 4 3 195 1 19...

result:

ok ok

Test #14:

score: 0
Accepted
time: 42ms
memory: 7740kb

input:

72 197
195 140 65 80 45 104 92 126 57 125 157 18 135 117 107 1 172 197 49 142 78 134 52 191 151 181 73 138 150 180 130 93 59 108 188 9 81 51 123 79 178 42 6 17 119 55 118 97 37 22 71 20 36 58 141 165 136 77 30 91 187 190 82 120 129 69 63 2 11 35 19
122 47 62 27 86 74 108 39 107 139 197 117 99 89 180...

output:

Yes
195 140 65 80 45 104 92 126 57 125 157 18 135 117 107 1 172 197 49 142 78 134 52 191 151 181 73 138 150 180 130 93 59 108 188 9 81 51 123 79 178 42 6 17 119 55 118 97 37 22 71 20 36 58 141 165 136 77 30 91 187 190 82 120 129 69 63 2 11 35 19 196 3 4 5 194 193 7 192 8 189 186 14 13 10 12 185 16 1...

result:

ok ok

Test #15:

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

input:

143 195
82 97 92 117 11 73 21 153 143 63 12 135 4 133 91 60 178 66 76 18 118 1 104 171 106 31 139 187 70 108 179 34 87 85 188 41 101 113 122 191 165 145 121 83 123 159 49 158 164 62 84 126 177 51 7 184 152 19 3 77 10 2 103 95 163 24 107 39 64 67 96 5 80 16 89 102 134 182 14 161 142 99 125 136 109 16...

output:

Yes
82 97 92 117 11 73 21 153 143 63 12 135 4 133 91 60 178 66 76 18 118 1 104 171 106 31 139 187 70 108 179 34 87 85 188 41 101 113 122 191 165 145 121 83 123 159 49 158 164 62 84 126 177 51 7 184 152 19 3 77 10 2 103 95 163 24 107 39 64 67 96 5 80 16 89 102 134 182 14 161 142 99 125 136 109 162 55...

result:

ok ok

Test #16:

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

input:

174 193
79 119 86 42 174 7 101 170 146 44 38 73 50 138 24 14 151 163 148 25 106 173 116 74 67 76 182 193 37 39 131 123 40 137 13 176 97 126 190 142 47 156 6 185 109 3 120 113 90 17 177 32 57 29 100 127 41 33 46 30 186 144 118 58 62 104 48 71 105 191 179 20 72 167 145 102 187 82 98 11 133 2 4 112 169...

output:

Yes
79 119 86 42 174 7 101 170 146 44 38 73 50 138 24 14 151 163 148 25 106 173 116 74 67 76 182 193 37 39 131 123 40 137 13 176 97 126 190 142 47 156 6 185 109 3 120 113 90 17 177 32 57 29 100 127 41 33 46 30 186 144 118 58 62 104 48 71 105 191 179 20 72 167 145 102 187 82 98 11 133 2 4 112 169 157...

result:

ok ok

Test #17:

score: 0
Accepted
time: 46ms
memory: 7736kb

input:

15 191
66 175 49 145 124 75 69 94 101 170 57 141 181 54
186 60 156 135 86 80 105 112 181 68 152 1 65
169 74 53 4 189 23 30 99 177 70 110 174
139 118 69 63 88 95 164 51 135 175 48
23 165 159 184 191 69 147 40 80 144
144 138 163 170 48 126 19 59 123
89 114 121 190 77 161 10 74
108 115 184 71 155 4 68
...

output:

Yes
66 175 49 145 124 75 69 94 101 170 57 141 181 54 1 191 3 4 189 188 6 5 2 7 10 11 13 12 15 14 16 17 18 8 19 9 180 187 20 21 23 177 22 190 173 172 25 24 186 171 26 185 27 28 29 167 30 166 184 165 31 164 32 182 33 183 34 163 36 35 159 158 37 161 38 39 40 179 178 156 41 154 42 176 43 174 44 153 45 1...

result:

ok ok

Test #18:

score: 0
Accepted
time: 34ms
memory: 7916kb

input:

63 189
105 46 157 174 34 8 64 51 181 61 29 175 135 161 75 150 90 92 154 47 26 156 155 69 97 14 78 164 17 41 15 184 163 152 159 180 54 85 134 132 53 99 3 128 2 39 89 127 88 171 166 7 81 182 31 10 172 162 153 108 114 57
99 21 38 87 61 117 104 45 114 82 39 188 25 128 14 143 145 18 100 79 20 19 122 150 ...

output:

Yes
105 46 157 174 34 8 64 51 181 61 29 175 135 161 75 150 90 92 154 47 26 156 155 69 97 14 78 164 17 41 15 184 163 152 159 180 54 85 134 132 53 99 3 128 2 39 89 127 88 171 166 7 81 182 31 10 172 162 153 108 114 57 1 4 189 187 186 185 9 5 11 6 13 188 179 12 16 23 21 28 20 19 18 25 173 22 176 168 170...

result:

ok ok

Test #19:

score: 0
Accepted
time: 23ms
memory: 7688kb

input:

112 187
180 49 19 105 158 132 103 32 168 31 8 42 178 128 30 62 13 40 150 162 144 172 87 174 97 177 4 175 37 171 135 80 34 46 28 58 54 18 122 136 84 147 15 35 77 63 91 161 170 179 167 38 76 187 36 115 96 146 93 9 25 33 142 109 23 27 44 176 47 90 152 169 131 2 78 102 155 22 154 182 120 98 156 165 53 6...

output:

Yes
180 49 19 105 158 132 103 32 168 31 8 42 178 128 30 62 13 40 150 162 144 172 87 174 97 177 4 175 37 171 135 80 34 46 28 58 54 18 122 136 84 147 15 35 77 63 91 161 170 179 167 38 76 187 36 115 96 146 93 9 25 33 142 109 23 27 44 176 47 90 152 169 131 2 78 102 155 22 154 182 120 98 156 165 53 66 3 ...

result:

ok ok

Test #20:

score: 0
Accepted
time: 16ms
memory: 7600kb

input:

126 185
111 155 67 158 102 139 129 31 4 92 96 25 145 32 66 7 117 108 112 156 143 71 86 101 6 135 46 30 185 146 132 18 10 131 75 93 70 84 98 52 90 21 3 14 61 174 142 157 181 80 22 82 8 161 97 184 44 76 77 1 38 59 167 63 49 162 118 176 178 99 64 128 100 114 41 134 17 57 9 141 119 105 180 35 182 154 19...

output:

Yes
111 155 67 158 102 139 129 31 4 92 96 25 145 32 66 7 117 108 112 156 143 71 86 101 6 135 46 30 185 146 132 18 10 131 75 93 70 84 98 52 90 21 3 14 61 174 142 157 181 80 22 82 8 161 97 184 44 76 77 1 38 59 167 63 49 162 118 176 178 99 64 128 100 114 41 134 17 57 9 141 119 105 180 35 182 154 19 152...

result:

ok ok

Test #21:

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

input:

162 183
173 132 82 107 22 65 83 80 102 171 5 104 119 81 9 151 32 133 116 78 142 131 105 18 6 178 144 21 37 13 54 59 48 167 163 55 35 64 39 137 97 45 74 174 50 92 159 169 153 94 129 130 95 17 73 160 101 85 76 62 14 150 168 112 141 68 180 99 172 120 140 138 177 61 79 29 8 143 84 2 46 60 38 118 139 77 ...

output:

Yes
173 132 82 107 22 65 83 80 102 171 5 104 119 81 9 151 32 133 116 78 142 131 105 18 6 178 144 21 37 13 54 59 48 167 163 55 35 64 39 137 97 45 74 174 50 92 159 169 153 94 129 130 95 17 73 160 101 85 76 62 14 150 168 112 141 68 180 99 172 120 140 138 177 61 79 29 8 143 84 2 46 60 38 118 139 77 136 ...

result:

ok ok

Test #22:

score: 0
Accepted
time: 27ms
memory: 7588kb

input:

89 181
105 176 72 16 98 52 51 108 160 7 134 32 144 128 88 123 20 129 152 122 126 110 171 25 130 19 151 21 101 181 76 114 58 27 28 111 178 113 22 56 104 79 60 64 33 3 157 139 6 85 143 50 8 103 5 71 14 115 180 80 97 117 37 57 10 138 69 132 30 48 141 164 166 148 179 159 75 149 162 118 175 87 11 133 24 ...

output:

Yes
105 176 72 16 98 52 51 108 160 7 134 32 144 128 88 123 20 129 152 122 126 110 171 25 130 19 151 21 101 181 76 114 58 27 28 111 178 113 22 56 104 79 60 64 33 3 157 139 6 85 143 50 8 103 5 71 14 115 180 80 97 117 37 57 10 138 69 132 30 48 141 164 166 148 179 159 75 149 162 118 175 87 11 133 24 70 ...

result:

ok ok

Test #23:

score: 0
Accepted
time: 24ms
memory: 7564kb

input:

87 181
160 140 120 60 115 63 179 148 17 53 126 3 58 55 178 76 139 33 94 86 117 111 29 161 14 48 62 97 106 132 77 170 155 127 28 16 31 153 136 83 18 147 22 59 67 176 151 87 172 40 39 30 142 32 21 95 54 42 105 78 85 45 9 91 110 181 175 101 167 65 81 64 2 146 92 66 75 99 157 80 8 72 116 149 174 163
94 ...

output:

Yes
160 140 120 60 115 63 179 148 17 53 126 3 58 55 178 76 139 33 94 86 117 111 29 161 14 48 62 97 106 132 77 170 155 127 28 16 31 153 136 83 18 147 22 59 67 176 151 87 172 40 39 30 142 32 21 95 54 42 105 78 85 45 9 91 110 181 175 101 167 65 81 64 2 146 92 66 75 99 157 80 8 72 116 149 174 163 180 4 ...

result:

ok ok

Test #24:

score: 0
Accepted
time: 32ms
memory: 8024kb

input:

105 199
169 119 3 158 156 112 12 34 89 83 43 191 4 94 28 17 87 30 5 168 182 76 192 56 181 33 189 82 35 107 97 63 8 52 68 117 196 1 173 32 57 98 139 67 134 125 6 165 54 176 93 31 62 42 10 135 199 86 36 153 114 7 91 95 20 118 157 144 23 146 51 44 162 71 11 110 194 164 150 47 171 90 187 145 126 184 29 ...

output:

Yes
169 119 3 158 156 112 12 34 89 83 43 191 4 94 28 17 87 30 5 168 182 76 192 56 181 33 189 82 35 107 97 63 8 52 68 117 196 1 173 32 57 98 139 67 134 125 6 165 54 176 93 31 62 42 10 135 199 86 36 153 114 7 91 95 20 118 157 144 23 146 51 44 162 71 11 110 194 164 150 47 171 90 187 145 126 184 29 122 ...

result:

ok ok

Test #25:

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

input:

141 191
3 80 104 142 19 97 58 63 134 68 59 14 13 35 154 85 33 112 83 23 190 144 51 1 119 185 72 32 103 129 96 151 176 71 5 75 22 78 124 34 141 69 136 42 70 160 76 7 191 57 110 156 11 26 161 111 93 6 84 36 12 169 46 118 135 179 27 92 41 38 152 28 100 172 43 18 121 138 25 186 79 8 4 53 147 178 180 125...

output:

Yes
3 80 104 142 19 97 58 63 134 68 59 14 13 35 154 85 33 112 83 23 190 144 51 1 119 185 72 32 103 129 96 151 176 71 5 75 22 78 124 34 141 69 136 42 70 160 76 7 191 57 110 156 11 26 161 111 93 6 84 36 12 169 46 118 135 179 27 92 41 38 152 28 100 172 43 18 121 138 25 186 79 8 4 53 147 178 180 125 77 ...

result:

ok ok

Test #26:

score: 0
Accepted
time: 43ms
memory: 7760kb

input:

57 199
141 192 97 102 69 87 106 149 46 146 100 48 125 43 25 143 40 58 176 76 145 93 197 42 11 8 110 112 167 160 30 92 134 90 73 136 162 163 84 68 170 70 39 116 91 77 14 199 130 107 179 183 119 86 20 65
79 159 104 113 61 55 194 179 174 85 184 158 39 169 102 51 157 44 67 87 142 167 183 81 97 181 83 12...

output:

Yes
141 192 97 102 69 87 106 149 46 146 100 48 125 43 25 143 40 58 176 76 145 93 197 42 11 8 110 112 167 160 30 92 134 90 73 136 162 163 84 68 170 70 39 116 91 77 14 199 130 107 179 183 119 86 20 65 1 3 4 2 196 6 5 198 9 194 12 7 193 10 190 191 189 24 22 16 18 21 19 13 23 17 15 195 185 184 182 181 4...

result:

ok ok

Test #27:

score: 0
Accepted
time: 20ms
memory: 7832kb

input:

121 187
103 83 37 1 74 154 135 180 19 120 96 23 126 73 130 34 139 87 58 137 66 105 20 92 32 89 91 163 67 112 147 72 142 125 94 118 116 48 49 113 69 93 185 160 184 55 46 152 165 36 174 127 186 54 44 27 7 151 63 86 8 39 181 122 110 102 64 143 144 108 53 187 133 88 145 167 12 2 6 4 148 158 35 173 109 1...

output:

Yes
103 83 37 1 74 154 135 180 19 120 96 23 126 73 130 34 139 87 58 137 66 105 20 92 32 89 91 163 67 112 147 72 142 125 94 118 116 48 49 113 69 93 185 160 184 55 46 152 165 36 174 127 186 54 44 27 7 151 63 86 8 39 181 122 110 102 64 143 144 108 53 187 133 88 145 167 12 2 6 4 148 158 35 173 109 17 17...

result:

ok ok

Test #28:

score: 0
Accepted
time: 16ms
memory: 7576kb

input:

111 183
28 24 3 21 165 77 8 167 95 118 154 127 36 66 38 54 43 23 98 183 64 146 178 153 125 155 131 166 115 103 130 4 50 13 9 96 144 7 108 69 150 109 30 70 168 90 61 162 112 34 15 147 16 31 76 60 121 83 151 88 17 113 182 126 138 80 143 139 29 134 10 174 55 18 107 14 79 94 11 39 159 35 22 2 149 81 136...

output:

Yes
28 24 3 21 165 77 8 167 95 118 154 127 36 66 38 54 43 23 98 183 64 146 178 153 125 155 131 166 115 103 130 4 50 13 9 96 144 7 108 69 150 109 30 70 168 90 61 162 112 34 15 147 16 31 76 60 121 83 151 88 17 113 182 126 138 80 143 139 29 134 10 174 55 18 107 14 79 94 11 39 159 35 22 2 149 81 136 86 ...

result:

ok ok

Test #29:

score: 0
Accepted
time: 46ms
memory: 7684kb

input:

44 193
161 149 68 4 64 31 191 76 17 193 96 16 24 101 123 87 170 133 33 39 52 163 132 102 86 63 166 10 1 62 168 106 160 155 190 158 129 187 100 71 36 114 59
95 126 68 120 12 116 57 153 60 124 27 5 46 56 7 20 24 25 138 50 47 43 22 144 96 123 84 145 97 183 53 67 41 104 122 106 30 143 175 64 133 65
120 ...

output:

Yes
161 149 68 4 64 31 191 76 17 193 96 16 24 101 123 87 170 133 33 39 52 163 132 102 86 63 166 10 1 62 168 106 160 155 190 158 129 187 100 71 36 114 59 192 189 3 188 7 12 186 5 9 6 8 185 184 2 15 19 13 14 11 182 18 20 180 25 28 30 27 32 26 35 37 43 44 45 42 48 41 34 46 47 40 38 23 21 167 29 49 51 5...

result:

ok ok

Test #30:

score: 0
Accepted
time: 36ms
memory: 7692kb

input:

88 197
69 161 16 148 97 108 46 4 183 7 43 177 123 168 5 59 13 140 6 164 122 139 125 27 25 70 77 55 76 156 94 118 137 131 37 104 154 62 83 138 17 115 188 160 14 133 149 153 135 88 180 12 38 173 151 18 24 22 196 170 23 89 68 20 75 66 87 134 60 73 166 195 110 113 111 26 78 159 179 186 129 121 92 155 10...

output:

Yes
69 161 16 148 97 108 46 4 183 7 43 177 123 168 5 59 13 140 6 164 122 139 125 27 25 70 77 55 76 156 94 118 137 131 37 104 154 62 83 138 17 115 188 160 14 133 149 153 135 88 180 12 38 173 151 18 24 22 196 170 23 89 68 20 75 66 87 134 60 73 166 195 110 113 111 26 78 159 179 186 129 121 92 155 100 1...

result:

ok ok

Test #31:

score: 0
Accepted
time: 49ms
memory: 7700kb

input:

38 195
70 32 57 147 188 103 44 59 19 108 67 14 180 186 63 8 154 133 3 170 28 162 38 27 58 155 121 137 84 73 15 148 143 18 49 172 110
150 108 90 112 54 148 64 100 184 20 163 129 40 128 83 89 194 32 175 183 43 8 182 165 132 6 139 16 88 67 11 56 2 7 45 137
183 145 144 138 75 29 149 125 3 108 184 97 69 ...

output:

Yes
70 32 57 147 188 103 44 59 19 108 67 14 180 186 63 8 154 133 3 170 28 162 38 27 58 155 121 137 84 73 15 148 143 18 49 172 110 1 2 194 6 4 192 7 9 5 195 10 13 12 193 17 16 11 184 183 182 185 191 181 25 26 36 22 31 30 34 29 39 23 40 24 41 37 35 33 45 42 43 21 20 166 169 167 165 46 164 47 48 161 51...

result:

ok ok

Test #32:

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

input:

167 185
9 64 91 14 161 37 11 112 67 48 7 89 34 162 166 175 146 86 117 17 182 40 158 42 160 139 177 151 99 59 47 90 144 26 128 8 87 43 123 20 83 124 97 60 127 6 92 145 77 121 31 62 120 10 82 104 183 44 39 72 28 71 36 149 24 29 103 165 55 18 30 155 66 163 168 159 58 52 85 181 4 27 98 180 126 185 147 1...

output:

Yes
9 64 91 14 161 37 11 112 67 48 7 89 34 162 166 175 146 86 117 17 182 40 158 42 160 139 177 151 99 59 47 90 144 26 128 8 87 43 123 20 83 124 97 60 127 6 92 145 77 121 31 62 120 10 82 104 183 44 39 72 28 71 36 149 24 29 103 165 55 18 30 155 66 163 168 159 58 52 85 181 4 27 98 180 126 185 147 118 1...

result:

ok ok

Test #33:

score: 0
Accepted
time: 45ms
memory: 6996kb

input:

1 199

output:

Yes
1 199 2 198 3 197 4 196 5 195 6 194 7 193 8 192 9 191 10 190 11 189 12 188 13 187 14 186 15 185 16 184 17 183 18 182 19 181 20 180 21 179 22 178 23 177 24 176 25 175 26 174 27 173 28 172 29 171 30 170 31 169 32 168 33 167 34 166 35 165 36 164 37 163 38 162 39 161 40 160 41 159 42 158 43 157 44 1...

result:

ok ok

Test #34:

score: 0
Accepted
time: 1ms
memory: 5824kb

input:

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

output:

No

result:

ok ok

Test #35:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1 200

output:

No

result:

ok ok

Test #36:

score: 0
Accepted
time: 1ms
memory: 5980kb

input:

3 6
1 2
3

output:

No

result:

ok ok