用户输出
1
11
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20762 | #1068. 1-08G. JM的最短路径问题 | Accepted | 100 | 1921 ms | 26892 K | C++ 11 / 1.7 K | RBQRBQ | 2019-08-02 15:02:46 |
#include <bits/stdc++.h>
#define N 200000
using namespace std;
int n, m, k, x, y;
int first[N + 5], nxt[2 * N + 5], to[2 * N + 5], len;
inline void add(int x, int y) {
nxt[len] = first[x];
first[x] = len;
to[len] = y;
len++;
}
bool vis[N + 5];
int depth[N + 5], tox[N + 5], toy[N + 5];
int toward[N + 5], lazy[N + 5], Q[N + 5];
int cnt, resp;
string ans[N + 5];
void update(int i) {
if (toward[i] == 1)
ans[cnt] += "1";
else
ans[cnt] += "0";
}
void dfs(int t) {
if (cnt == k)
return;
if (m + 2 + resp < n + t)
return;
if (t == m + 1) {
if (resp == n - 1) {
cnt++;
for (int i = 1; i <= m; i++) {
update(i);
}
}
return;
}
if (toward[t] == -1) {
dfs(t + 1);
return;
}
Q[tox[t]]--;
if (lazy[tox[t]] == 0 && toward[t] == 0) {
toward[t] = 1;
lazy[tox[t]] = 1;
resp++;
dfs(t + 1);
resp--;
lazy[tox[t]] = 0;
toward[t] = 0;
}
if (Q[tox[t]] == 0 && lazy[tox[t]] == 0) {
Q[tox[t]]++;
return;
}
dfs(t + 1);
Q[tox[t]]++;
}
queue<int> q;
int main() {
cin >> n >> m >> k;
memset(first, -1, sizeof(first));
for (int i = 1; i <= m; i++) {
scanf("%d%d", &x, &y);
add(x, y), add(y, x);
tox[i] = x, toy[i] = y;
}
q.push(1), vis[1] = true;
depth[1] = 1;
while (!q.empty()) {
int tmp = q.front();
q.pop();
for (int i = first[tmp];; i = nxt[i]) {
if (i == -1)
break;
int u = to[i];
if (vis[u])
continue;
vis[u] = true;
depth[u] = depth[tmp] + 1;
q.push(u);
}
}
for (int i = 1; i <= m; i++) {
if (!(depth[tox[i]] >= depth[toy[i]]))
swap(tox[i], toy[i]);
if (depth[tox[i]] == depth[toy[i]] + 1) {
Q[tox[i]]++;
}
if (depth[tox[i]] == depth[toy[i]])
toward[i] = -1;
}
dfs(1);
printf("%d\n", cnt);
for (int i = 1; i <= cnt; i++) {
for (int j = 0; j < m; j++) {
printf("%c", ans[i][j]);
}
putchar('\n');
}
return 0;
}
用户输出
4
111100
111001
110110
110011
系统信息
Exited with return code 0
用户输出
2
1110
1011
系统信息
Exited with return code 0
用户输出
1
101001
系统信息
Exited with return code 0
用户输出
2
111100
111001
系统信息
Exited with return code 0
用户输出
1
100111
系统信息
Exited with return code 0
用户输出
1
001101110
系统信息
Exited with return code 0
6
10111001111001
10111001110101
00111011111001
00111011110101
00111001111011
00111001110111
用户输出
6
10111001111001
10111001110101
00111011111001
00111011110101
00111001111011
00111001110111
系统信息
Exited with return code 0
15 20 100
6 7
15 11
2 15
9 5
9 1
8 2
2 10
2 12
3 11
5 12
14 9
4 11
11 2
13 5
12 7
6
<25 bytes omitted>
用户输出
4
10111100111101010111
10111100101101110111
10111100011111010111
10111100001111110111
系统信息
Exited with return code 0
16 20 100
9 12
7 1
9 6
1 5
5 14
9 11
6 1
3 1
1 16
5 6
11 3
9 5
10 7
13 1
4 3
5 16
9
<22 bytes omitted>
用户输出
4
11111011101011101110
11110011101011101111
11011011101111101110
11010011101111101111
系统信息
Exited with return code 0
16 20 100
8 4
2 16
8 7
6 11
8 9
10 4
1 4
3 9
5 8
3 14
5 6
11 4
10 15
1 16
9 5
13 10
<24 bytes omitted>
用户输出
2
11110111011011010111
11100111011111010111
系统信息
Exited with return code 0
16 20 100
7 8
6 5
15 1
7 2
2 12
1 7
7 9
13 15
11 14
3 10
8 3
2 14
3 4
1 5
4 15
10 12
<26 bytes omitted>
8
11111111011101101010
11111111011001101011
11111111010111101010
11111111010011101011
111111110
<79 bytes omitted>
用户输出
8
11111111011101101010
11111111011001101011
11111111010111101010
11111111010011101011
11111111001101111010
11111111001001111011
<42 bytes omitted>
系统信息
Exited with return code 0
16 20 100
6 3
15 16
14 2
15 5
6 12
13 16
9 12
16 3
5 11
16 14
10 8
4 3
2 7
8 14
2 3
<28 bytes omitted>
用户输出
4
11001111101111110110
11001111101110110111
10011111101111110110
10011111101110110111
系统信息
Exited with return code 0
16 20 100
4 6
7 15
10 5
8 6
9 11
12 15
14 1
13 7
12 2
4 12
14 16
3 16
9 15
4 5
8 15
<29 bytes omitted>
6
11111011101111011001
11111011101101111001
11111011011111011001
11111011011101111001
111110110
<35 bytes omitted>
用户输出
6
11111011101111011001
11111011101101111001
11111011011111011001
11111011011101111001
11111011001111011101
11111011001101111101
系统信息
Exited with return code 0
18 23 100
5 13
10 2
6 3
8 2
1 16
18 10
12 1
2 1
18 2
6 2
4 1
16 7
15 18
17 11
9 17
1
<49 bytes omitted>
4
11111011111101101101100
11111011111101001111100
01111011111101101101110
0111101111110100111111
<3 bytes omitted>
用户输出
4
11111011111101101101100
11111011111101001111100
01111011111101101101110
01111011111101001111110
系统信息
Exited with return code 0
18 23 100
12 14
2 11
1 13
2 7
18 17
16 13
9 13
15 1
9 12
3 4
10 11
18 4
2 18
13 8
5 6
<48 bytes omitted>
4
11111111110111100100110
11111111110111100010110
11111111110011100101110
1111111111001110001111
<3 bytes omitted>
用户输出
4
11111111110111100100110
11111111110111100010110
11111111110011100101110
11111111110011100011110
系统信息
Exited with return code 0
18 23 100
14 1
4 3
2 9
16 10
10 12
10 1
6 15
1 8
3 12
11 14
9 8
15 1
15 9
7 10
1 5
1
<49 bytes omitted>
4
11111111011101111000011
11111111010111111000011
11110111111101111000011
1111011111011111100001
<3 bytes omitted>
用户输出
4
11111111011101111000011
11111111010111111000011
11110111111101111000011
11110111110111111000011
系统信息
Exited with return code 0
18 23 100
5 13
6 7
8 2
13 7
18 12
11 18
9 5
5 4
17 15
11 4
6 13
13 15
18 16
14 15
4 8
<49 bytes omitted>
4
01111110110011011110111
01111110100011111110111
01101110110111011110111
0110111010011111111011
<3 bytes omitted>
用户输出
4
01111110110011011110111
01111110100011111110111
01101110110111011110111
01101110100111111110111
系统信息
Exited with return code 0
18 23 100
4 16
12 17
2 12
16 13
5 8
2 18
5 15
11 5
15 11
13 9
10 4
15 10
13 7
14 15
4
<49 bytes omitted>
4
11001111011011111110011
11001111010111111110011
01011111011011111110011
0101111101011111111001
<3 bytes omitted>
用户输出
4
11001111011011111110011
11001111010111111110011
01011111011011111110011
01011111010111111110011
系统信息
Exited with return code 0
50 70 10000
1 12
43 48
39 50
2 9
3 10
2 26
38 8
38 39
12 17
6 19
31 21
17 23
39 25
25
<381 bytes omitted>
1536
1111111110111011111111111001001111011101001111110101101001101100001011
1111111110111011111111
<110498 bytes omitted>
用户输出
1536
1111111110111011111111111001001111011101001111110101101001101100001011
1111111110111011111111111001001111011101001110110111
<108933 bytes omitted>
系统信息
Exited with return code 0
11 18 55555
1 2
1 3
2 4
2 5
3 4
3 5
4 6
4 7
5 6
5 7
6 8
6 9
7 8
7 9
8 10
8 11
9 10
<7 bytes omitted>
256
111100110011001100
111100110011001001
111100110011000110
111100110011000011
111100110010011
<5025 bytes omitted>
用户输出
256
111100110011001100
111100110011001001
111100110011000110
111100110011000011
111100110010011100
111100110010011001
1111001100
<4740 bytes omitted>
系统信息
Exited with return code 0
17 30 33333
1 2
1 3
2 4
2 5
3 4
3 5
4 6
4 7
5 6
5 7
6 8
6 9
7 8
7 9
8 10
8 11
9 10
<91 bytes omitted>
16384
111100110011001100110011001100
111100110011001100110011001001
11110011001100110011001100011
<524195 bytes omitted>
用户输出
16384
111100110011001100110011001100
111100110011001100110011001001
111100110011001100110011000110
11110011001100110011001100001
<507782 bytes omitted>
系统信息
Exited with return code 0
21 38 26315
1 2
1 3
2 4
2 5
3 4
3 5
4 6
4 7
5 6
5 7
6 8
6 9
7 8
7 9
8 10
8 11
9 10
<147 bytes omitted>
26315
11110011001100110011001100110011001100
11110011001100110011001100110011001001
1111001100110
<1052507 bytes omitted>
用户输出
26315
11110011001100110011001100110011001100
11110011001100110011001100110011001001
11110011001100110011001100110011000110
11110
<1026163 bytes omitted>
系统信息
Exited with return code 0
60 100 10000
15 8
38 1
9 52
43 48
41 14
36 24
40 50
17 32
56 6
57 19
1 58
35 38
45 13
2 40
60 9
39 2
<484 bytes omitted>
10000
111111111011110111111000000010011111110111100101110010000101010001110010001111010101110110001
<1019907 bytes omitted>
用户输出
10000
1111111110111101111110000000100111111101111001011100100001010100011100100011110101011101100010110101
111111111011110111111
<1009878 bytes omitted>
系统信息
Exited with return code 0
70 100 10000
27 61
60 24
14 59
1 15
51 66
29 14
43 35
50 37
69 45
39 22
53 62
26 48
59 15
49 26
15 5
<487 bytes omitted>
10000
111110111111111111110111111000011111000011010011011111101011100111110101011000101011111101011
<1019907 bytes omitted>
用户输出
10000
1111101111111111111101111110000111110000110100110111111010111001111101010110001010111111010110101110
111110111111111111110
<1009878 bytes omitted>
系统信息
Exited with return code 0
10000 20000 50
6058 5831
7627 4199
110 625
8448 3408
6892 8141
7330 3565
9357 7
9873 342
8897 7158
5
<195532 bytes omitted>
50
111011001011000000010111110111111010111011111110101110111111110100111111001111111110001111101001
<1000004 bytes omitted>
用户输出
50
11101100101100000001011111011111101011101111111010111011111111010011111100111111111000111110100110011111111011011100101011101
<999925 bytes omitted>
系统信息
Exited with return code 0
10000 20000 50
1033 1905
3460 6300
2951 4230
9132 4742
2214 3056
8918 4400
8082 773
7830 2062
9982 9
<195515 bytes omitted>
50
111111111111110111101101111111010110011111111110111111010011111010111111101001111111101110110111
<1000004 bytes omitted>
用户输出
50
11111111111111011110110111111101011001111111111011111101001111101011111110100111111110111011011110011111110110111111110100110
<999925 bytes omitted>
系统信息
Exited with return code 0
10000 20000 50
6847 3482
817 3510
5123 1951
5304 7208
3742 1032
5717 2194
4923 7301
6246 811
8238 38
<195437 bytes omitted>
50
110111111110111101111000111111110011011111100001111101101111101110101011111101110010101001111011
<1000004 bytes omitted>
用户输出
50
11011111111011110111100011111111001101111110000111110110111110111010101111110111001010100111101101101000011110101111111101111
<999925 bytes omitted>
系统信息
Exited with return code 0
100000 200000 5
5288 66997
269 62477
5814 98286
13854 35535
69987 11113
25615 15393
58259 97349
2249
<2355583 bytes omitted>
5
1011111101011110111101111111101110110011011111011111101111111111110110101111111100100111111100111
<999913 bytes omitted>
用户输出
5
101111110101111011110111111110111011001101111101111110111111111111011010111111110010011111110011110101111111111111111111100111
<999879 bytes omitted>
系统信息
Exited with return code 0
100000 200000 5
45437 10342
44133 50047
89844 57436
35625 95126
99613 23809
28134 81440
459 22867
31
<2355778 bytes omitted>
5
1111011010011111111110001011110111000111111111101101001001111111011111111101100111111111111111011
<999913 bytes omitted>
用户输出
5
111101101001111111111000101111011100011111111110110100100111111101111111110110011111111111111101111000001110111110111011110100
<999879 bytes omitted>
系统信息
Exited with return code 0
100000 200000 5
72662 259
91387 89352
43750 9698
58271 64237
72021 59557
4552 19824
56421 91539
1248
<2355530 bytes omitted>
5
1111011011111011011111111111111110111110100010111010110111110111100101111101111100110110111010110
<999913 bytes omitted>
用户输出
5
111101101111101101111111111111111011111010001011101011011111011110010111110111110011011011101011011110011101001111111011010110
<999879 bytes omitted>
系统信息
Exited with return code 0
1000 200000 5
755 942
475 775
602 689
640 210
706 141
566 687
760 797
228 183
814 428
980 405
923 23
<1557473 bytes omitted>
5
1000110101100110000010011100010001100100111010011111000010101011011101001001101010000011001010000
<999913 bytes omitted>
用户输出
5
100011010110011000001001110001000110010011101001111100001010101101110100100110101000001100101000011000100100001111010100001001
<999879 bytes omitted>
系统信息
Exited with return code 0
1000 200000 5
134 693
836 367
482 570
668 929
930 558
617 679
141 462
822 707
576 763
512 498
502 12
<1557154 bytes omitted>
5
1010100000000000111000100001111100110100001100011011011111100001000011000101000011000001110110101
<999913 bytes omitted>
用户输出
5
101010000000000011100010000111110011010000110001101101111110000100001100010100001100000111011010110100110011010010110111011111
<999879 bytes omitted>
系统信息
Exited with return code 0
1000 20000 50
946 410
682 771
489 583
728 539
536 656
994 907
555 1
266 127
394 559
122 934
973 453
<155563 bytes omitted>
50
111011111110000101101101110010111000100110011000000001010010101101010000010001110101100000100101
<1000004 bytes omitted>
用户输出
50
11101111111000010110110111001011100010011001100000000101001010110101000001000111010110000010010111110010101010101000000111000
<999925 bytes omitted>
系统信息
Exited with return code 0
1000 20000 50
770 555
656 713
734 858
763 559
23 372
742 652
944 40
201 412
822 755
683 914
598 664
<155673 bytes omitted>
50
010001000010000001001000100100010001010101000000110010101110000100000000000001011100000000011000
<1000004 bytes omitted>
用户输出
50
01000100001000000100100010010001000101010100000011001010111000010000000000000101110000000001100010000010100110000000001001100
<999925 bytes omitted>
系统信息
Exited with return code 0
101 910 1098
86 88
32 38
83 88
69 67
26 75
37 58
31 32
27 41
23 42
11 76
17 95
9 81
83 55
90 99
81 1
<5254 bytes omitted>
1098
0100100110000000001101000000100001010010001000001001101001001010000000000000001001000001000000
<1001282 bytes omitted>
用户输出
1098
010010011000000000110100000010000101001000100000100110100100101000000000000000100100000100000000000001100000100000000001000
<1000155 bytes omitted>
系统信息
Exited with return code 0
26 105 9523
7 22
26 6
13 20
18 12
6 1
25 3
14 18
15 19
7 12
5 10
16 22
18 13
1 25
20 19
16 2
2 10
2
<467 bytes omitted>
2304
1100110010001000001011101001000000100010000000001000000001110001000000000110100000100000000100
<246434 bytes omitted>
用户输出
2304
110011001000100000101110100100000010001000000000100000000111000100000000011010000010000000010000000000100
11001100100010000
<244101 bytes omitted>
系统信息
Exited with return code 0
26 105 9523
1 11
24 8
25 12
16 19
16 13
16 8
24 15
20 23
18 2
12 22
12 23
17 10
16 9
17 19
7 13
13 9
<478 bytes omitted>
9523
1110100100000000110100100101000011100000000000010000110010100000000010010001001000100001000000
<1018867 bytes omitted>
用户输出
9523
111010010000000011010010010100001110000000000001000011001010000000001001000100100010000100000000000000000
11101001000000001
<1009315 bytes omitted>
系统信息
Exited with return code 0
41 78 12820
26 25
38 2
36 27
4 36
24 40
25 5
19 14
4 22
27 37
13 20
18 6
21 10
19 34
26 17
31 27
36
<346 bytes omitted>
12820
011111110110110011001011011111101100011110010010100000001000010100101010001110
0111111101101
<1025507 bytes omitted>
用户输出
12820
011111110110110011001011011111101100011110010010100000001000010100101010001110
0111111101101100110010110111111011000111100
<1012658 bytes omitted>
系统信息
Exited with return code 0
102 198 5050
83 79
73 35
39 30
31 79
26 38
101 36
38 29
47 54
52 1
41 49
73 88
46 88
63 46
1 33
42 7
<1085 bytes omitted>
5050
1011111011001101100101001111101101111010001110101101110110110111111010001111010111001101101001
<1009906 bytes omitted>
用户输出
5050
101111101100110110010100111110110111101000111010110111011011011111101000111101011100110110100101011000100010011000100110011
<1004827 bytes omitted>
系统信息
Exited with return code 0
1019 1972 500
261 496
405 855
946 491
28 814
78 334
938 1004
517 150
65 250
114 721
588 714
877 754
<15367 bytes omitted>
500
11011010001011111100001111100111111010101111101111111011111110111001110101001101101111011111010
<986905 bytes omitted>
用户输出
500
1101101000101111110000111110011111101010111110111111101111111011100111010100110110111101111101010110110001110101110100101111
<986376 bytes omitted>
系统信息
Exited with return code 0
10172 18765 49
8675 8281
56 7711
7304 3714
1625 1207
6893 9729
8527 6536
859 4207
7510 2968
4617 878
<184128 bytes omitted>
49
111110101010111101100110111111011111111111110001111111111111001111101111000100110111111111100110
<919487 bytes omitted>
用户输出
49
11111010101011110110011011111101111111111111000111111111111100111110111100010011011111111110011011111111110111011101001111110
<919409 bytes omitted>
系统信息
Exited with return code 0
20254 39998 21
16666 17950
9556 19055
8811 7496
5477 7841
6433 11698
14778 15913
4220 17854
17530 53
<436023 bytes omitted>
21
111001101110110111110111011111101111111111111111111110111101111111100111011001110101101110111101
<839904 bytes omitted>
用户输出
21
11100110111011011111011101111110111111111111111111111011110111111110011101100111010110111011110110101011110001100111111111111
<839854 bytes omitted>
系统信息
Exited with return code 0
46318 78521 10
7727 21263
42519 44968
41236 4161
28790 22964
37871 27235
11725 32384
28473 41375
131
<904691 bytes omitted>
10
111111110110011011011010111110111011111111111111101101110111111111111110111111111110101111111111
<785134 bytes omitted>
用户输出
10
11111111011001101101101011111011101111111111111110110111011111111111111011111111111010111111111111111001101110111111111111101
<785095 bytes omitted>
系统信息
Exited with return code 0
200000 200000 5
114079 181756
79232 71046
70285 17203
34351 199109
83828 190462
74596 111695
147119
<2577827 bytes omitted>
2
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
<399907 bytes omitted>
用户输出
2
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
<399876 bytes omitted>
系统信息
Exited with return code 0
99998 100000 10
96653 56927
81423 55810
59451 63093
44056 93429
45626 97641
57608 46703
19114 20322
<1177845 bytes omitted>
2
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
<199907 bytes omitted>
用户输出
2
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
<199876 bytes omitted>
系统信息
Exited with return code 0
180000 180001 5
120960 85527
158406 61941
178311 158686
50693 145763
63784 46782
145852 173482
20815
<2298114 bytes omitted>
2
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
<359909 bytes omitted>
用户输出
2
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
<359878 bytes omitted>
系统信息
Exited with return code 0