用户输出
2
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#49195 | #1257. 车 | Wrong Answer | 40 | 116 ms | 376 K | C++ 11 / 924 B | 新媒体91-雷广涵 | 2021-05-25 12:06:49 |
#include <iostream>
using namespace std;
const int MAX_N = 1005;
struct Pos {
int x;
int y;
int status;
};
int cnt = 0;
void dfs(Pos *pos, int m, int i);
void visit(Pos *pos, int m) {
for (int i = 0; i < m; i++) {
if (pos[i].status == 1) {
dfs(pos, m, i);
cnt++;
}
}
}
void dfs(Pos *pos, int m, int i) {
pos[i].status = 0;
int x = pos[i].x;
int y = pos[i].y;
for (int k = i + 1; k < m; k++) {
if (pos[k].status == 1 && (pos[k].x == x || pos[k].y == y)) {
dfs(pos, m, k);
}
}
}
int main() {
int n, m, x, y;
cin >> n >> m;
Pos *pos = new Pos[m];
for (int i = 0; i < m; i++) {
cin >> x >> y;
pos[i].x = x;
pos[i].y = y;
pos[i].status = 1;
}
visit(pos, m);
cout << m - cnt << endl;
return 0;
}
用户输出
8
系统信息
Exited with return code 0
用户输出
7
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
9
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
9
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
16
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
13
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
4
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
14
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
10
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>
用户输出
276
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>
用户输出
311
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>
用户输出
2
系统信息
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>
用户输出
75
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>
用户输出
534
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>
用户输出
399
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>
用户输出
694
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>
用户输出
429
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>
用户输出
701
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>
用户输出
649
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>
用户输出
48
系统信息
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>
用户输出
224
系统信息
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>
用户输出
675
系统信息
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>
用户输出
960
系统信息
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>
用户输出
588
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>
用户输出
575
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>
用户输出
580
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>
用户输出
591
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>
用户输出
573
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>
用户输出
584
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>
用户输出
586
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>
用户输出
589
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>
用户输出
600
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>
用户输出
580
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
9
系统信息
Exited with return code 0
用户输出
9
系统信息
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>
用户输出
99
系统信息
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>
用户输出
99
系统信息
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>
用户输出
999
系统信息
Exited with return code 0