QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#364145#8310. Fixing Networksucup-team173#AC ✓13ms8660kbC++201.9kb2024-03-24 12:26:242024-03-24 12:26:24

Judging History

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

  • [2024-03-24 12:26:24]
  • 评测
  • 测评结果:AC
  • 用时:13ms
  • 内存:8660kb
  • [2024-03-24 12:26:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define Mp make_pair
#define SZ(x) (int((x).size()))

typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void solve() {
    ll n, d, c;
    cin >> n >> d >> c;
    if(d == 0) {
        if(n == c) {
            cout << "Yes\n";
            for(int i = 1; i <= n; i++)
                cout << '\n';
        } else {
            cout << "No\n";
        }
        return;
    }
    if(d == 1) {
        if(n % 2 || c != n / 2) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
            for(int i = 1; i <= n; i++) {
                if(i % 2) cout << i + 1;
                else cout << i - 1;
                cout << '\n';
            }
        }
        return;
    }
    if(c * (d + 1) > n || n * d % 2) {
        cout << "No\n";
        return;
    }
    ll lst = n - (c - 1) * (d + 1);
    vector G(n, vi());
    auto add = [&](int x, int y) {
        G[x].pb(y), G[y].pb(x);
    };
    for(int t = lst; t < n; t += d + 1) {
        for(int i = 0; i < d + 1; i++) {
            for(int j = 1; j <= d; j++) {
                G[i + t].pb((t + (i + j) % (d + 1)));
            }
        }
    }
    for(int t = 1; t <= d / 2; t++) {
        for(int i = 0; i < lst; i++) {
            add(i, (i + t) % lst);
        }
    }
    if(d % 2) {
        assert(lst % 2 == 0);
        for(int i = 0; i < lst / 2; i++) {
            add(i, i + lst / 2);
        }
    }
    cout << "Yes\n";
    for(int i = 0; i < n; i++) {
        sort(G[i].begin(), G[i].end());
        for(int j : G[i]) cout << j + 1 << ' ';
        cout << '\n';
    }
}
signed main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3852kb

input:

12 3 2

output:

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

result:

ok n=12 d=3 c=2

Test #2:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

3 2 2

output:

No

result:

ok n=3 d=2 c=2

Test #3:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

1 0 1

output:

Yes


result:

ok n=1 d=0 c=1

Test #4:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

2 0 1

output:

No

result:

ok n=2 d=0 c=1

Test #5:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

2 0 2

output:

Yes



result:

ok n=2 d=0 c=2

Test #6:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

3 0 2

output:

No

result:

ok n=3 d=0 c=2

Test #7:

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

input:

100000 0 100000

output:

Yes








































































































































































































































































































...

result:

ok n=100000 d=0 c=100000

Test #8:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

2 1 1

output:

Yes
2
1

result:

ok n=2 d=1 c=1

Test #9:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

2 1 2

output:

No

result:

ok n=2 d=1 c=2

Test #10:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

3 1 1

output:

No

result:

ok n=3 d=1 c=1

Test #11:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

3 1 2

output:

No

result:

ok n=3 d=1 c=2

Test #12:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

3 1 3

output:

No

result:

ok n=3 d=1 c=3

Test #13:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

4 1 1

output:

No

result:

ok n=4 d=1 c=1

Test #14:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

4 1 2

output:

Yes
2
1
4
3

result:

ok n=4 d=1 c=2

Test #15:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

4 1 3

output:

No

result:

ok n=4 d=1 c=3

Test #16:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

4 1 4

output:

No

result:

ok n=4 d=1 c=4

Test #17:

score: 0
Accepted
time: 4ms
memory: 3836kb

input:

100000 1 50000

output:

Yes
2
1
4
3
6
5
8
7
10
9
12
11
14
13
16
15
18
17
20
19
22
21
24
23
26
25
28
27
30
29
32
31
34
33
36
35
38
37
40
39
42
41
44
43
46
45
48
47
50
49
52
51
54
53
56
55
58
57
60
59
62
61
64
63
66
65
68
67
70
69
72
71
74
73
76
75
78
77
80
79
82
81
84
83
86
85
88
87
90
89
92
91
94
93
96
95
98
97
100
99
102
...

result:

ok n=100000 d=1 c=50000

Test #18:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

3 2 1

output:

Yes
2 3 
1 3 
1 2 

result:

ok n=3 d=2 c=1

Test #19:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

4 2 1

output:

Yes
2 4 
1 3 
2 4 
1 3 

result:

ok n=4 d=2 c=1

Test #20:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

6 2 1

output:

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

result:

ok n=6 d=2 c=1

Test #21:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

6 2 2

output:

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

result:

ok n=6 d=2 c=2

Test #22:

score: 0
Accepted
time: 10ms
memory: 8620kb

input:

100000 2 1

output:

Yes
2 100000 
1 3 
2 4 
3 5 
4 6 
5 7 
6 8 
7 9 
8 10 
9 11 
10 12 
11 13 
12 14 
13 15 
14 16 
15 17 
16 18 
17 19 
18 20 
19 21 
20 22 
21 23 
22 24 
23 25 
24 26 
25 27 
26 28 
27 29 
28 30 
29 31 
30 32 
31 33 
32 34 
33 35 
34 36 
35 37 
36 38 
37 39 
38 40 
39 41 
40 42 
41 43 
42 44 
43 45 
4...

result:

ok n=100000 d=2 c=1

Test #23:

score: 0
Accepted
time: 13ms
memory: 8660kb

input:

100000 2 316

output:

Yes
2 99055 
1 3 
2 4 
3 5 
4 6 
5 7 
6 8 
7 9 
8 10 
9 11 
10 12 
11 13 
12 14 
13 15 
14 16 
15 17 
16 18 
17 19 
18 20 
19 21 
20 22 
21 23 
22 24 
23 25 
24 26 
25 27 
26 28 
27 29 
28 30 
29 31 
30 32 
31 33 
32 34 
33 35 
34 36 
35 37 
36 38 
37 39 
38 40 
39 41 
40 42 
41 43 
42 44 
43 45 
44...

result:

ok n=100000 d=2 c=316

Test #24:

score: 0
Accepted
time: 10ms
memory: 8576kb

input:

100000 2 33333

output:

Yes
2 4 
1 3 
2 4 
1 3 
6 7 
5 7 
5 6 
9 10 
8 10 
8 9 
12 13 
11 13 
11 12 
15 16 
14 16 
14 15 
18 19 
17 19 
17 18 
21 22 
20 22 
20 21 
24 25 
23 25 
23 24 
27 28 
26 28 
26 27 
30 31 
29 31 
29 30 
33 34 
32 34 
32 33 
36 37 
35 37 
35 36 
39 40 
38 40 
38 39 
42 43 
41 43 
41 42 
45 46 
44 46 ...

result:

ok n=100000 d=2 c=33333

Test #25:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

4 3 1

output:

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

result:

ok n=4 d=3 c=1

Test #26:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

4 3 2

output:

No

result:

ok n=4 d=3 c=2

Test #27:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

8 3 1

output:

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

result:

ok n=8 d=3 c=1

Test #28:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

8 3 2

output:

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

result:

ok n=8 d=3 c=2

Test #29:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

9 3 1

output:

No

result:

ok n=9 d=3 c=1

Test #30:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

9 3 2

output:

No

result:

ok n=9 d=3 c=2

Test #31:

score: 0
Accepted
time: 9ms
memory: 6936kb

input:

66666 3 1

output:

Yes
2 33334 66666 
1 3 33335 
2 4 33336 
3 5 33337 
4 6 33338 
5 7 33339 
6 8 33340 
7 9 33341 
8 10 33342 
9 11 33343 
10 12 33344 
11 13 33345 
12 14 33346 
13 15 33347 
14 16 33348 
15 17 33349 
16 18 33350 
17 19 33351 
18 20 33352 
19 21 33353 
20 22 33354 
21 23 33355 
22 24 33356 
23 25 33357...

result:

ok n=66666 d=3 c=1

Test #32:

score: 0
Accepted
time: 13ms
memory: 6888kb

input:

66666 3 16666

output:

Yes
2 4 6 
1 3 5 
2 4 6 
1 3 5 
2 4 6 
1 3 5 
8 9 10 
7 9 10 
7 8 10 
7 8 9 
12 13 14 
11 13 14 
11 12 14 
11 12 13 
16 17 18 
15 17 18 
15 16 18 
15 16 17 
20 21 22 
19 21 22 
19 20 22 
19 20 21 
24 25 26 
23 25 26 
23 24 26 
23 24 25 
28 29 30 
27 29 30 
27 28 30 
27 28 29 
32 33 34 
31 33 34 
31 ...

result:

ok n=66666 d=3 c=16666

Test #33:

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

input:

20000 10 1

output:

Yes
2 3 4 5 6 19996 19997 19998 19999 20000 
1 3 4 5 6 7 19997 19998 19999 20000 
1 2 4 5 6 7 8 19998 19999 20000 
1 2 3 5 6 7 8 9 19999 20000 
1 2 3 4 6 7 8 9 10 20000 
1 2 3 4 5 7 8 9 10 11 
2 3 4 5 6 8 9 10 11 12 
3 4 5 6 7 9 10 11 12 13 
4 5 6 7 8 10 11 12 13 14 
5 6 7 8 9 11 12 13 14 15 
6 7 8 ...

result:

ok n=20000 d=10 c=1

Test #34:

score: 0
Accepted
time: 7ms
memory: 5236kb

input:

20000 10 100

output:

Yes
2 3 4 5 6 18907 18908 18909 18910 18911 
1 3 4 5 6 7 18908 18909 18910 18911 
1 2 4 5 6 7 8 18909 18910 18911 
1 2 3 5 6 7 8 9 18910 18911 
1 2 3 4 6 7 8 9 10 18911 
1 2 3 4 5 7 8 9 10 11 
2 3 4 5 6 8 9 10 11 12 
3 4 5 6 7 9 10 11 12 13 
4 5 6 7 8 10 11 12 13 14 
5 6 7 8 9 11 12 13 14 15 
6 7 8 ...

result:

ok n=20000 d=10 c=100

Test #35:

score: 0
Accepted
time: 5ms
memory: 5164kb

input:

20000 10 1818

output:

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

result:

ok n=20000 d=10 c=1818

Test #36:

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

input:

18180 11 1

output:

Yes
2 3 4 5 6 9091 18176 18177 18178 18179 18180 
1 3 4 5 6 7 9092 18177 18178 18179 18180 
1 2 4 5 6 7 8 9093 18178 18179 18180 
1 2 3 5 6 7 8 9 9094 18179 18180 
1 2 3 4 6 7 8 9 10 9095 18180 
1 2 3 4 5 7 8 9 10 11 9096 
2 3 4 5 6 8 9 10 11 12 9097 
3 4 5 6 7 9 10 11 12 13 9098 
4 5 6 7 8 10 11 12...

result:

ok n=18180 d=11 c=1

Test #37:

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

input:

18180 11 100

output:

Yes
2 3 4 5 6 8497 16988 16989 16990 16991 16992 
1 3 4 5 6 7 8498 16989 16990 16991 16992 
1 2 4 5 6 7 8 8499 16990 16991 16992 
1 2 3 5 6 7 8 9 8500 16991 16992 
1 2 3 4 6 7 8 9 10 8501 16992 
1 2 3 4 5 7 8 9 10 11 8502 
2 3 4 5 6 8 9 10 11 12 8503 
3 4 5 6 7 9 10 11 12 13 8504 
4 5 6 7 8 10 11 12...

result:

ok n=18180 d=11 c=100

Test #38:

score: 0
Accepted
time: 10ms
memory: 5040kb

input:

18180 11 1515

output:

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

result:

ok n=18180 d=11 c=1515

Test #39:

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

input:

101 100 1

output:

Yes
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 
1...

result:

ok n=101 d=100 c=1

Test #40:

score: 0
Accepted
time: 9ms
memory: 4508kb

input:

2000 100 10

output:

Yes
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 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072...

result:

ok n=2000 d=100 c=10

Test #41:

score: 0
Accepted
time: 9ms
memory: 4640kb

input:

2000 100 19

output:

Yes
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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 17...

result:

ok n=2000 d=100 c=19

Test #42:

score: 0
Accepted
time: 9ms
memory: 4532kb

input:

1980 101 1

output:

Yes
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 991 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 ...

result:

ok n=1980 d=101 c=1

Test #43:

score: 0
Accepted
time: 9ms
memory: 4504kb

input:

1980 101 10

output:

Yes
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 532 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 ...

result:

ok n=1980 d=101 c=10

Test #44:

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

input:

1980 101 19

output:

Yes
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 73 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 ...

result:

ok n=1980 d=101 c=19

Test #45:

score: 0
Accepted
time: 10ms
memory: 4260kb

input:

447 446 1

output:

Yes
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok n=447 d=446 c=1

Extra Test:

score: 0
Extra Test Passed