用户输出
1 1 1 2
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#48979 | #1257. 车 | Wrong Answer | 0 | 191 ms | 4340 K | C++ 17 / 1.6 K | XYZ | 2021-05-19 23:57:16 |
#include <bits/stdc++.h>
#define MAX_M 1000
#define ii pair<int, int>
using namespace std;
ii coords[MAX_M];
map<ii, int> rcds;
int parent[MAX_M];
int find(int x) {
if (parent[x] > 0)
parent[x] = find(parent[x]); //递归查找,同时起到了压缩路径的作用
return parent[x] > 0 ? parent[x] : x; //返回父亲节点,根节点返回自身
}
void union_set(int x, int y) {
x = find(x), y = find(y); //查找父亲节点
if (x != y) //合并时不能是相同父亲节点的
{
if (parent[x] < parent[y]) //比较大小,小的连到大的上
{
parent[x] += parent[y];
parent[y] = x;
} else {
parent[y] += parent[x];
parent[x] = y;
}
}
}
int main() {
int n;
int m;
cin >> n >> m;
vector<vector<int> > board(n, vector<int>(n));
for (int i = 0; i < m; i++) {
int x, y;
scanf("%d %d", &x, &y);
x--;
y--;
board[x][y] = 1;
ii xy = make_pair(x, y);
coords[i] = xy;
rcds[xy] = i;
}
memset(parent, -1, sizeof(parent));
for (int i = 0; i < m; i++) {
ii xy = coords[i];
int x = xy.first;
int y = xy.second;
for (int j = y + 1; j < n; j++) {
if (board[x][j]) {
union_set(i, rcds[ii(x, j)]);
}
}
for (int j = x + 1; j < n; j++) {
if (board[j][y]) {
union_set(i, rcds[ii(j, y)]);
}
}
}
set<int> res;
for (int i = 0; i < m; i++) {
printf("%d ", find(i));
res.insert(find(i));
}
int ans = m - res.size();
printf("%d", ans);
return 0;
}
用户输出
1 1 1 2
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1 1 1 1 3
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0 1 2 3 4 0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0 0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1 1 1 1 1 5 5 5 5 5 10 11 8
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
3 5 3 3 10 5 3 3 3 10 10 10 9
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0 0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1 1 1 1 1 1 1 1 1 1 1 1 1 12
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
11 11 11 11 11 11 11 11 11 11 11 11 11 12
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 17
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
3 1 3 3 4 2
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 17
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
3 3 3 3 3 3 5
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 16
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
901 598
565 361
500 175
205 860
524 404
193 20
190 212
379 254
654 653
174 763
344 42
271 140
76 774
<4567 bytes omitted>
用户输出
126 1 455 3 533 5 6 139 531 545 346 11 351 13 14 320 436 17 395 19 483 367 363 406 126 25 26 27 28 126 30 31 32 33 244 98 113 10
<2201 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
530 551
370 236
26 367
405 200
55 355
436 316
478 344
397 315
476 392
60 512
233 526
514 248
429 325
<4086 bytes omitted>
用户输出
406 536 58 506 58 5 6 7 58 9 58 58 58 58 14 124 215 65 429 416 58 58 22 298 351 506 58 210 61 58 520 406 58 196 58 58 479 58 38
<1873 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
904 84
121 471
711 121
862 151
441 193
514 539
479 427
342 129
583 269
260 175
607 462
641 578
282 2
<560 bytes omitted>
用户输出
0 1 2 3 37 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
<116 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
322 197
178 243
39 189
83 306
293 89
254 60
223 82
96 176
262 302
276 15
135 248
265 232
63 281
179
<1356 bytes omitted>
用户输出
0 133 195 3 165 19 163 135 62 9 10 127 173 13 14 78 173 131 18 19 177 21 62 191 175 189 131 27 28 175 30 31 32 78 34 35 127 37 3
<578 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
569 804
264 153
179 489
204 404
121 227
309 101
534 470
361 276
537 107
474 107
513 334
167 332
313
<6023 bytes omitted>
用户输出
227 1 596 392 269 241 596 596 596 596 596 596 596 596 596 596 166 227 18 596 596 596 450 596 674 25 596 694 596 596 596 166 596
<3069 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
254 526
54 106
142 201
49 219
238 117
136 242
171 196
132 49
59 44
195 169
103 230
222 77
154 159
14
<3680 bytes omitted>
用户输出
44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 296 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 4
<1471 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
300 844
197 204
168 265
277 270
101 251
192 36
222 79
270 212
242 139
161 124
169 220
182 249
177 25
<6051 bytes omitted>
用户输出
588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588 588
<3250 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
503 668
81 343
481 83
182 390
22 300
487 210
278 503
164 337
90 1
437 244
219 20
98 97
210 262
76 42
<5008 bytes omitted>
用户输出
665 294 665 665 665 5 294 7 665 9 10 665 665 140 665 665 665 665 440 665 665 665 665 665 665 665 507 27 665 440 665 157 32 480 6
<2522 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
300 848
273 182
240 132
279 174
237 281
279 180
131 34
24 238
239 8
274 237
63 24
79 233
204 105
75
<6055 bytes omitted>
用户输出
187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187
<3266 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
166 728
126 14
151 109
118 126
112 37
76 151
6 71
98 94
117 79
101 90
84 42
117 112
42 7
54 6
155 98
<4795 bytes omitted>
用户输出
721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721 721
<2787 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0 0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
7 49
1 1
1 2
1 3
1 4
1 5
1 6
1 7
2 1
2 2
2 3
2 4
2 5
2 6
2 7
3 1
3 2
3 3
3 4
3 5
3 6
3 7
4 1
4 2
4 3
<101 bytes omitted>
用户输出
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 1 1 1 1 1 1 1 1 1 1 1 48
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
15 225
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
2 1
2 2
2 3
2 4
2 5
2 6
2 7
<987 bytes omitted>
用户输出
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 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
<325 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
26 676
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1
<3495 bytes omitted>
用户输出
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 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
<1227 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
31 961
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1
<5115 bytes omitted>
用户输出
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 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
<1797 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
1 1
1 2
2 2
4 3
3 4
4 4
5 5
6 5
6 6
7 7
8 7
7 8
9 9
9 10
10 10
12 11
11 12
12 12
13 13
14 13
<7576 bytes omitted>
用户输出
1 1 1 5 5 5 7 7 7 11 11 11 13 13 13 17 17 17 19 19 19 22 22 22 25 25 25 28 28 28 31 31 31 35 35 35 37 37 37 40 40 40 43 43 43 46
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
2 1
1 2
2 2
4 3
3 4
4 4
5 5
6 5
6 6
8 7
7 8
8 8
9 9
10 9
9 10
12 11
11 12
12 12
13 13
14 13
<7576 bytes omitted>
用户输出
2 2 2 5 5 5 7 7 7 11 11 11 14 14 14 17 17 17 20 20 20 23 23 23 25 25 25 28 28 28 32 32 32 35 35 35 37 37 37 41 41 41 43 43 43 46
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
2 1
1 2
2 2
3 3
4 3
4 4
6 5
5 6
6 6
7 7
7 8
8 8
9 9
10 9
10 10
11 11
11 12
12 12
13 13
14 13
<7576 bytes omitted>
用户输出
2 2 2 4 4 4 8 8 8 10 10 10 13 13 13 16 16 16 19 19 19 23 23 23 25 25 25 28 28 28 31 31 31 35 35 35 37 37 37 40 40 40 44 44 44 46
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
2 1
1 2
2 2
3 3
4 3
3 4
5 5
6 5
5 6
8 7
7 8
8 8
9 9
10 9
10 10
11 11
11 12
12 12
13 13
14 13
<7575 bytes omitted>
用户输出
2 2 2 5 5 5 8 8 8 11 11 11 13 13 13 16 16 16 19 19 19 23 23 23 25 25 25 28 28 28 31 31 31 34 34 34 37 37 37 40 40 40 43 43 43 47
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
2 1
1 2
2 2
3 3
3 4
4 4
5 5
6 5
6 6
7 7
7 8
8 8
9 9
10 9
10 10
11 11
11 12
12 12
13 13
14 13
<7576 bytes omitted>
用户输出
2 2 2 4 4 4 7 7 7 10 10 10 13 13 13 16 16 16 19 19 19 23 23 23 25 25 25 28 28 28 31 31 31 35 35 35 37 37 37 40 40 40 44 44 44 47
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
1 1
1 2
2 2
3 3
4 3
4 4
5 5
5 6
6 6
7 7
8 7
8 8
9 9
10 9
9 10
11 11
11 12
12 12
14 13
13 14
<7575 bytes omitted>
用户输出
1 1 1 4 4 4 7 7 7 10 10 10 14 14 14 16 16 16 20 20 20 22 22 22 26 26 26 29 29 29 31 31 31 35 35 35 37 37 37 40 40 40 43 43 43 46
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
1 1
2 1
2 2
3 3
3 4
4 4
6 5
5 6
6 6
7 7
8 7
8 8
9 9
10 9
10 10
11 11
12 11
12 12
13 13
14 13
<7577 bytes omitted>
用户输出
1 1 1 4 4 4 8 8 8 10 10 10 13 13 13 16 16 16 20 20 20 23 23 23 25 25 25 28 28 28 31 31 31 34 34 34 38 38 38 41 41 41 43 43 43 46
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
1 1
2 1
1 2
3 3
4 3
3 4
5 5
5 6
6 6
7 7
7 8
8 8
9 9
10 9
10 10
11 11
12 11
11 12
13 13
13 14
<7575 bytes omitted>
用户输出
2 2 2 5 5 5 7 7 7 10 10 10 13 13 13 17 17 17 19 19 19 22 22 22 26 26 26 28 28 28 32 32 32 35 35 35 38 38 38 40 40 40 44 44 44 47
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
2 1
1 2
2 2
3 3
4 3
3 4
5 5
5 6
6 6
8 7
7 8
8 8
9 9
10 9
10 10
11 11
12 11
12 12
13 13
14 13
<7576 bytes omitted>
用户输出
2 2 2 5 5 5 7 7 7 11 11 11 13 13 13 16 16 16 19 19 19 23 23 23 25 25 25 28 28 28 31 31 31 35 35 35 37 37 37 41 41 41 44 44 44 47
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
666 999
2 1
1 2
2 2
3 3
4 3
3 4
5 5
6 5
5 6
7 7
8 7
7 8
9 9
10 9
9 10
12 11
11 12
12 12
13 13
13 14
<7575 bytes omitted>
用户输出
2 2 2 5 5 5 8 8 8 11 11 11 14 14 14 17 17 17 19 19 19 22 22 22 26 26 26 28 28 28 32 32 32 34 34 34 37 37 37 41 41 41 43 43 43 46
<3763 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0 0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1 1 1 1 1 1 1 1 1 1 9
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1 1 1 1 1 1 1 1 1 1 9
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100 100
1 55
2 55
3 55
4 55
5 55
6 55
7 55
8 55
9 55
10 55
11 55
12 55
13 55
14 55
15 55
16 55
17 55
<500 bytes omitted>
用户输出
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 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
<74 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100 100
81 1
81 2
81 3
81 4
81 5
81 6
81 7
81 8
81 9
81 10
81 11
81 12
81 13
81 14
81 15
81 16
81 17
<500 bytes omitted>
用户输出
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 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
<74 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000 1000
1 608
2 608
3 608
4 608
5 608
6 608
7 608
8 608
9 608
10 608
11 608
12 608
13 608
14 608
1
<7803 bytes omitted>
用户输出
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 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
<1875 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
1000 1000
485 1
485 2
485 3
485 4
485 5
485 6
485 7
485 8
485 9
485 10
485 11
485 12
485 13
485 14
4
<7803 bytes omitted>
用户输出
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 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
<1875 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0