QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387315#8195. Satelityjames1BadCreeper100 ✓235ms50972kbC++143.0kb2024-04-12 13:11:072024-04-12 13:11:08

Judging History

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

  • [2024-04-12 13:11:08]
  • 评测
  • 测评结果:100
  • 用时:235ms
  • 内存:50972kb
  • [2024-04-12 13:11:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std; 
typedef unsigned long long u64; 
const u64 B = 10007; 

int n, PP, M; 
mt19937_64 Rand(time(0)); 
u64 ha[1005], vl[1005], p[2005]; 
vector<char> ans[2005]; 
set<int> Q[1005]; 
map<u64, vector<int>> mp; 
int fa[1005]; 
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }

int main(void) {
    ios::sync_with_stdio(0); 
    for (int i = p[0] = 1; i <= 2000; ++i) p[i] = p[i - 1] * B; 

    cin >> n >> PP >> M; 
    for (int i = 1; i <= n; ++i) vl[i] = Rand(); 
    while (PP--) {
        int x, y; cin >> x >> y; 
        if (x > y) swap(x, y); 
        Q[x].insert(y); 
        ha[x] += vl[y - n]; 
    }
    for (int i = 1; i <= n; ++i) fa[i] = i; 
    for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j)
        if (ha[i] == ha[j]) fa[find(j)] = find(i); 

    for (int i = 1; i <= n; ++i) if (find(i) == i) {
        for (int j = 1; j <= n; ++j) 
            if (find(i) == find(j)) ans[j].push_back('A'); 
            else ans[j].push_back('B'); 

        for (int j = 1; j <= n; ++j)
            if (Q[i].count(j + n)) ans[j + n].push_back('A'); 
            else ans[j + n].push_back('C'); 
    }

    for (int i = 1; i <= n * 2; ++i) {
        u64 val = 0; 
        for (int j = 0; j < ans[i].size(); ++j)
            val = val * B + ans[i][j]; 
        mp[val].push_back(i); 
    }
    int mx = 0; 
    for (const auto& [x, y] : mp) mx = max(mx, int(y.size())); 
    cerr << mx << "\n"; 

    if (mx == n * 2) {
        int t = 0, res = 1; 
        while (res < mx) res <<= 1, ++t; 
        for (const auto& [x, y] : mp) {
            int et = y[0]; 
            for (int i = 0; i < y.size(); ++i)
                for (int j = t - 1; j >= 0; --j)
                    ans[y[i]].push_back(char((i >> j & 1) + 'A')); 
        }
    } else {

        int t = 0, res = 1; 
        while (res < mx) res <<= 1, ++t; 
        for (int i = 1; i <= t; ++i) 
            for (int j = n + 1; j <= n * 2; ++j)
                ans[j].push_back('C'); 
        for (const auto& [x, y] : mp) {
            int et = y[0]; 
            if (et > n) continue; 
            for (int i = 0; i < y.size(); ++i)
                for (int j = t - 1; j >= 0; --j)
                    ans[y[i]].push_back(char((i >> j & 1) + 'A')); 
        }
        for (int i = 1; i <= t; ++i) 
            for (int j = 1; j <= n; ++j)
                ans[j].push_back('C'); 
        for (const auto& [x, y] : mp) {
            int et = y[0]; 
            if (et <= n) continue; 
            for (int i = 0; i < y.size(); ++i)
                for (int j = t - 1; j >= 0; --j)
                    ans[y[i]].push_back(char((i >> j & 1) + 'A')); 
        }

        if (!t) {
            for (int i = 1; i <= n; ++i) ans[i].push_back('A'), ans[i + n].push_back('B'); 
        }
    }

    cout << ans[1].size() << '\n'; 
    for (int i = 1; i <= n * 2; ++i) {
        for (int j = 0; j < ans[1].size(); ++j) cout << ans[i][j]; 
        cout << '\n'; 
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 2ms
memory: 4096kb

input:

100 5340 10200
1 101
1 102
1 104
1 105
1 106
1 107
1 108
1 109
1 116
1 119
1 120
1 123
1 125
1 126
1 127
1 129
1 132
1 133
1 135
1 136
1 137
1 138
1 141
1 144
1 146
1 147
1 148
1 149
1 151
1 155
1 156
1 158
1 159
1 160
1 161
1 163
1 165
1 167
1 168
1 169
1 170
1 172
1 173
1 174
1 175
1 177
1 178
1 1...

output:

101
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA
BABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA
BBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #2:

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

input:

100 658 10200
1 104
1 148
1 169
1 175
1 177
1 181
1 187
1 188
2 132
2 190
3 119
3 147
3 154
3 163
3 165
3 177
3 184
3 199
4 102
4 105
4 130
4 132
4 138
4 160
4 183
4 192
4 199
5 113
5 152
5 153
5 165
5 186
5 194
6 111
6 114
6 134
6 155
6 199
7 109
7 120
7 128
7 131
7 136
7 143
7 191
8 104
8 107
8 17...

output:

101
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA
BABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA
BBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #3:

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

input:

100 9540 10200
1 101
1 102
1 103
1 104
1 105
1 106
1 107
1 108
1 109
1 110
1 111
1 112
1 113
1 114
1 115
1 116
1 117
1 118
1 119
1 120
1 121
1 122
1 123
1 124
1 125
1 126
1 127
1 128
1 129
1 131
1 132
1 133
1 134
1 135
1 136
1 137
1 138
1 139
1 140
1 141
1 142
1 143
1 144
1 145
1 146
1 147
1 148
1 1...

output:

101
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA
BABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA
BBABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #4:

score: 0
Accepted
time: 2ms
memory: 4384kb

input:

100 10000 10200
1 101
1 102
1 103
1 104
1 105
1 106
1 107
1 108
1 109
1 110
1 111
1 112
1 113
1 114
1 115
1 116
1 117
1 118
1 119
1 120
1 121
1 122
1 123
1 124
1 125
1 126
1 127
1 128
1 129
1 130
1 131
1 132
1 133
1 134
1 135
1 136
1 137
1 138
1 139
1 140
1 141
1 142
1 143
1 144
1 145
1 146
1 147
1 ...

output:

9
AAAAAAAAA
AAAAAAAAB
AAAAAAABA
AAAAAAABB
AAAAAABAA
AAAAAABAB
AAAAAABBA
AAAAAABBB
AAAAABAAA
AAAAABAAB
AAAAABABA
AAAAABABB
AAAAABBAA
AAAAABBAB
AAAAABBBA
AAAAABBBB
AAAABAAAA
AAAABAAAB
AAAABAABA
AAAABAABB
AAAABABAA
AAAABABAB
AAAABABBA
AAAABABBB
AAAABBAAA
AAAABBAAB
AAAABBABA
AAAABBABB
AAAABBBAA
AAAABBBA...

result:

ok correct

Test #5:

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

input:

100 1 10200
91 111

output:

16
ABAAAAAAACCCCCCC
ABAAAAAABCCCCCCC
ABAAAAABACCCCCCC
ABAAAAABBCCCCCCC
ABAAAABAACCCCCCC
ABAAAABABCCCCCCC
ABAAAABBACCCCCCC
ABAAAABBBCCCCCCC
ABAAABAAACCCCCCC
ABAAABAABCCCCCCC
ABAAABABACCCCCCC
ABAAABABBCCCCCCC
ABAAABBAACCCCCCC
ABAAABBABCCCCCCC
ABAAABBBACCCCCCC
ABAAABBBBCCCCCCC
ABAABAAAACCCCCCC
ABAABAAA...

result:

ok correct

Test #6:

score: 0
Accepted
time: 2ms
memory: 4168kb

input:

100 6309 10200
1 101
1 102
1 103
1 104
1 105
1 106
1 107
1 108
1 109
1 110
1 111
1 112
1 113
1 114
2 101
2 102
2 103
2 104
2 105
2 106
2 107
2 108
2 109
2 110
2 111
2 112
2 113
2 114
3 101
3 102
3 103
3 104
3 105
3 106
3 107
3 108
3 109
3 110
3 111
3 112
3 113
3 114
4 101
4 102
4 103
4 104
4 105
4 1...

output:

18
ABBBBBBBBBAAAACCCC
ABBBBBBBBBAAABCCCC
ABBBBBBBBBAABACCCC
ABBBBBBBBBAABBCCCC
ABBBBBBBBBABAACCCC
ABBBBBBBBBABABCCCC
ABBBBBBBBBABBACCCC
ABBBBBBBBBABBBCCCC
BABBBBBBBBAAAACCCC
BABBBBBBBBAAABCCCC
BABBBBBBBBAABACCCC
BABBBBBBBBAABBCCCC
BABBBBBBBBABAACCCC
BABBBBBBBBABABCCCC
BABBBBBBBBABBACCCC
BABBBBBBBBAB...

result:

ok correct

Test #7:

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

input:

100 5460 10200
1 166
1 167
1 168
1 169
1 170
1 171
1 172
1 173
1 174
1 175
1 176
1 177
1 178
1 179
1 180
1 181
1 182
1 183
1 184
2 166
2 167
2 168
2 169
2 170
2 171
2 172
2 173
2 174
2 175
2 176
2 177
2 178
2 179
2 180
2 181
2 182
2 183
2 184
3 166
3 167
3 168
3 169
3 170
3 171
3 172
3 173
3 174
3 1...

output:

15
ABBBBAAAAACCCCC
ABBBBAAAABCCCCC
ABBBBAAABACCCCC
ABBBBAAABBCCCCC
ABBBBAABAACCCCC
ABBBBAABABCCCCC
ABBBBAABBACCCCC
ABBBBAABBBCCCCC
ABBBBABAAACCCCC
ABBBBABAABCCCCC
ABBBBABABACCCCC
ABBBBABABBCCCCC
ABBBBABBAACCCCC
ABBBBABBABCCCCC
ABBBBABBBACCCCC
ABBBBABBBBCCCCC
ABBBBBAAAACCCCC
ABBBBBAAABCCCCC
ABBBBBAAB...

result:

ok correct

Test #8:

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

input:

2 1 8
2 3

output:

3
ABA
BAA
CAB
CCB

result:

ok correct

Test #9:

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

input:

2 4 8
1 3
1 4
2 3
2 4

output:

3
AAA
AAB
ABA
ABB

result:

ok correct

Test #10:

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

input:

10 61 120
1 11
1 12
1 15
1 17
2 12
2 14
2 15
2 16
2 19
3 11
3 13
3 14
3 15
3 16
3 17
3 18
4 12
4 13
4 15
4 18
4 19
5 12
5 13
5 14
5 15
5 16
5 18
5 19
6 11
6 13
6 14
6 15
6 16
6 17
6 18
6 19
6 20
7 14
7 15
7 16
7 17
7 18
7 19
7 20
8 11
8 13
8 14
8 16
8 17
8 18
8 20
9 14
9 15
9 17
9 18
10 13
10 14
10 ...

output:

11
ABBBBBBBBBA
BABBBBBBBBA
BBABBBBBBBA
BBBABBBBBBA
BBBBABBBBBA
BBBBBABBBBA
BBBBBBABBBA
BBBBBBBABBA
BBBBBBBBABA
BBBBBBBBBAA
ACACCACACCB
AACAACCCCCB
CCAAAACACAB
CAACAAAAAAB
AAAAAAACAAB
CAACAAAACAB
ACACCAAAACB
CCAAAAAAAAB
CACAAAACCAB
CCCCCAAACCB

result:

ok correct

Subtask #2:

score: 11
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 11
Accepted
time: 156ms
memory: 31212kb

input:

1000 534931 3000
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1008
1 1009
1 1010
1 1014
1 1015
1 1016
1 1019
1 1020
1 1024
1 1026
1 1027
1 1028
1 1029
1 1030
1 1032
1 1033
1 1034
1 1036
1 1037
1 1038
1 1041
1 1043
1 1046
1 1047
1 1048
1 1049
1 1050
1 1053
1 1055
1 1057
1 1059
1 1061
1 1068
1 1071
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #12:

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

input:

1000 69798 3000
1 1001
1 1007
1 1009
1 1012
1 1013
1 1021
1 1039
1 1052
1 1121
1 1162
1 1188
1 1213
1 1224
1 1258
1 1272
1 1278
1 1281
1 1284
1 1289
1 1299
1 1302
1 1309
1 1334
1 1341
1 1344
1 1351
1 1365
1 1384
1 1395
1 1402
1 1426
1 1438
1 1460
1 1461
1 1466
1 1484
1 1528
1 1563
1 1567
1 1596
1 15...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #13:

score: 0
Accepted
time: 227ms
memory: 50780kb

input:

1000 953822 3000
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1032
1 1033
1 1035
1 1036
1 1037
1 1038
1 1039
1 1040
1 1042
1 1043
1 1044
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #14:

score: 0
Accepted
time: 156ms
memory: 50560kb

input:

997 994009 2991
1 998
1 999
1 1000
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038...

output:

12
AAAAAAAAAAAA
AAAAAAAAAAAB
AAAAAAAAAABA
AAAAAAAAAABB
AAAAAAAAABAA
AAAAAAAAABAB
AAAAAAAAABBA
AAAAAAAAABBB
AAAAAAAABAAA
AAAAAAAABAAB
AAAAAAAABABA
AAAAAAAABABB
AAAAAAAABBAA
AAAAAAAABBAB
AAAAAAAABBBA
AAAAAAAABBBB
AAAAAAABAAAA
AAAAAAABAAAB
AAAAAAABAABA
AAAAAAABAABB
AAAAAAABABAA
AAAAAAABABAB
AAAAAAABABB...

result:

ok correct

Test #15:

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

input:

997 1 2991
981 1021

output:

22
ABAAAAAAAAAACCCCCCCCCC
ABAAAAAAAAABCCCCCCCCCC
ABAAAAAAAABACCCCCCCCCC
ABAAAAAAAABBCCCCCCCCCC
ABAAAAAAABAACCCCCCCCCC
ABAAAAAAABABCCCCCCCCCC
ABAAAAAAABBACCCCCCCCCC
ABAAAAAAABBBCCCCCCCCCC
ABAAAAAABAAACCCCCCCCCC
ABAAAAAABAABCCCCCCCCCC
ABAAAAAABABACCCCCCCCCC
ABAAAAAABABBCCCCCCCCCC
ABAAAAAABBAACCCCCCCCC...

result:

ok correct

Test #16:

score: 0
Accepted
time: 79ms
memory: 26724kb

input:

1000 483246 3000
1 1116
1 1117
1 1118
1 1119
1 1120
1 1121
1 1122
1 1123
1 1124
1 1125
1 1126
1 1127
1 1128
1 1129
1 1130
1 1131
1 1132
1 1133
1 1134
1 1135
1 1136
1 1137
1 1138
1 1139
1 1140
1 1141
1 1142
1 1143
1 1144
1 1145
1 1146
1 1147
1 1148
1 1149
1 1150
1 1151
1 1152
1 1153
1 1154
1 1155
1 1...

output:

31
ABBBBBBBBBBBBBBBBAAAAAAACCCCCCC
ABBBBBBBBBBBBBBBBAAAAAABCCCCCCC
ABBBBBBBBBBBBBBBBAAAAABACCCCCCC
ABBBBBBBBBBBBBBBBAAAAABBCCCCCCC
ABBBBBBBBBBBBBBBBAAAABAACCCCCCC
ABBBBBBBBBBBBBBBBAAAABABCCCCCCC
ABBBBBBBBBBBBBBBBAAAABBACCCCCCC
ABBBBBBBBBBBBBBBBAAAABBBCCCCCCC
ABBBBBBBBBBBBBBBBAAABAAACCCCCCC
ABBBBBBBB...

result:

ok correct

Test #17:

score: 0
Accepted
time: 86ms
memory: 26724kb

input:

1000 483511 3000
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1039
1 1040
1 1...

output:

23
ABBBBBBAAAAAAAACCCCCCCC
ABBBBBBAAAAAAABCCCCCCCC
ABBBBBBAAAAAABACCCCCCCC
ABBBBBBAAAAAABBCCCCCCCC
ABBBBBBAAAAABAACCCCCCCC
ABBBBBBAAAAABABCCCCCCCC
ABBBBBBAAAAABBACCCCCCCC
ABBBBBBAAAAABBBCCCCCCCC
ABBBBBBAAAABAAACCCCCCCC
ABBBBBBAAAABAABCCCCCCCC
ABBBBBBAAAABABACCCCCCCC
ABBBBBBAAAABABBCCCCCCCC
ABBBBBBAA...

result:

ok correct

Test #18:

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

input:

2 1 6
2 3

output:

3
ABA
BAA
CAB
CCB

result:

ok correct

Subtask #3:

score: 23
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #19:

score: 23
Accepted
time: 156ms
memory: 31184kb

input:

1000 534275 1020
1 1002
1 1004
1 1005
1 1006
1 1007
1 1008
1 1010
1 1011
1 1013
1 1015
1 1016
1 1017
1 1019
1 1021
1 1023
1 1025
1 1026
1 1028
1 1029
1 1032
1 1033
1 1034
1 1035
1 1039
1 1040
1 1045
1 1047
1 1049
1 1050
1 1051
1 1052
1 1054
1 1056
1 1058
1 1059
1 1062
1 1063
1 1064
1 1065
1 1066
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #20:

score: 0
Accepted
time: 47ms
memory: 9488kb

input:

1000 70109 1020
1 1015
1 1052
1 1132
1 1144
1 1155
1 1173
1 1175
1 1180
1 1215
1 1216
1 1246
1 1260
1 1262
1 1272
1 1284
1 1298
1 1299
1 1300
1 1303
1 1316
1 1326
1 1331
1 1333
1 1336
1 1342
1 1355
1 1357
1 1381
1 1390
1 1413
1 1441
1 1460
1 1466
1 1471
1 1472
1 1487
1 1495
1 1530
1 1541
1 1543
1 15...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #21:

score: 0
Accepted
time: 235ms
memory: 50972kb

input:

1000 953540 1020
1 1001
1 1002
1 1003
1 1005
1 1006
1 1007
1 1008
1 1009
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1036
1 1037
1 1038
1 1039
1 1040
1 1041
1 1042
1 1043
1 1044
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #22:

score: 0
Accepted
time: 164ms
memory: 50568kb

input:

998 996004 1018
1 999
1 1000
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 103...

output:

12
AAAAAAAAAAAA
AAAAAAAAAAAB
AAAAAAAAAABA
AAAAAAAAAABB
AAAAAAAAABAA
AAAAAAAAABAB
AAAAAAAAABBA
AAAAAAAAABBB
AAAAAAAABAAA
AAAAAAAABAAB
AAAAAAAABABA
AAAAAAAABABB
AAAAAAAABBAA
AAAAAAAABBAB
AAAAAAAABBBA
AAAAAAAABBBB
AAAAAAABAAAA
AAAAAAABAAAB
AAAAAAABAABA
AAAAAAABAABB
AAAAAAABABAA
AAAAAAABABAB
AAAAAAABABB...

result:

ok correct

Test #23:

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

input:

998 1 1018
971 1031

output:

22
ABAAAAAAAAAACCCCCCCCCC
ABAAAAAAAAABCCCCCCCCCC
ABAAAAAAAABACCCCCCCCCC
ABAAAAAAAABBCCCCCCCCCC
ABAAAAAAABAACCCCCCCCCC
ABAAAAAAABABCCCCCCCCCC
ABAAAAAAABBACCCCCCCCCC
ABAAAAAAABBBCCCCCCCCCC
ABAAAAAABAAACCCCCCCCCC
ABAAAAAABAABCCCCCCCCCC
ABAAAAAABABACCCCCCCCCC
ABAAAAAABABBCCCCCCCCCC
ABAAAAAABBAACCCCCCCCC...

result:

ok correct

Test #24:

score: 0
Accepted
time: 79ms
memory: 27648kb

input:

1000 504451 1020
1 1164
1 1165
1 1166
1 1167
1 1168
1 1169
1 1170
1 1171
1 1172
1 1173
1 1174
1 1175
1 1176
1 1177
1 1178
1 1179
1 1180
1 1181
1 1182
1 1183
1 1184
1 1185
1 1186
1 1187
1 1188
1 1189
1 1190
1 1191
1 1192
1 1193
1 1194
1 1195
1 1196
1 1197
1 1198
1 1199
1 1200
1 1201
1 1202
1 1203
1 1...

output:

32
ABBBBBBBBBBBBBBBBBAAAAAAACCCCCCC
ABBBBBBBBBBBBBBBBBAAAAAABCCCCCCC
ABBBBBBBBBBBBBBBBBAAAAABACCCCCCC
ABBBBBBBBBBBBBBBBBAAAAABBCCCCCCC
ABBBBBBBBBBBBBBBBBAAAABAACCCCCCC
ABBBBBBBBBBBBBBBBBAAAABABCCCCCCC
ABBBBBBBBBBBBBBBBBAAAABBACCCCCCC
ABBBBBBBBBBBBBBBBBAAAABBBCCCCCCC
ABBBBBBBBBBBBBBBBBAAABAAACCCCCCC
...

result:

ok correct

Test #25:

score: 0
Accepted
time: 84ms
memory: 26820kb

input:

1000 487569 1020
1 1618
1 1619
1 1620
1 1621
1 1622
1 1623
1 1624
1 1625
1 1626
1 1627
1 1628
1 1629
1 1630
1 1631
1 1632
1 1633
1 1634
1 1635
1 1636
1 1637
1 1638
1 1639
1 1640
1 1641
1 1642
1 1643
1 1644
1 1645
1 1646
1 1647
1 1648
1 1649
1 1650
1 1651
1 1652
1 1653
1 1654
1 1655
1 1656
1 1657
1 1...

output:

24
ABBBBBBBAAAAAAAACCCCCCCC
ABBBBBBBAAAAAAABCCCCCCCC
ABBBBBBBAAAAAABACCCCCCCC
ABBBBBBBAAAAAABBCCCCCCCC
ABBBBBBBAAAAABAACCCCCCCC
ABBBBBBBAAAAABABCCCCCCCC
ABBBBBBBAAAAABBACCCCCCCC
ABBBBBBBAAAAABBBCCCCCCCC
ABBBBBBBAAAABAAACCCCCCCC
ABBBBBBBAAAABAABCCCCCCCC
ABBBBBBBAAAABABACCCCCCCC
ABBBBBBBAAAABABBCCCCCC...

result:

ok correct

Test #26:

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

input:

2 1 4
2 3

output:

3
ABA
BAA
CAB
CCB

result:

ok correct

Subtask #4:

score: 41
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #27:

score: 41
Accepted
time: 160ms
memory: 31196kb

input:

1000 534863 1002
1 1001
1 1002
1 1003
1 1004
1 1006
1 1008
1 1009
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1019
1 1020
1 1021
1 1022
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1036
1 1037
1 1038
1 1042
1 1043
1 1046
1 1047
1 1048
1 1049
1 1050
1 1051
1 1054
1 1055
1 1056
1 1057
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #28:

score: 0
Accepted
time: 37ms
memory: 9468kb

input:

1000 69689 1002
1 1011
1 1013
1 1024
1 1063
1 1064
1 1068
1 1102
1 1119
1 1148
1 1157
1 1161
1 1167
1 1186
1 1191
1 1212
1 1234
1 1239
1 1241
1 1260
1 1264
1 1272
1 1275
1 1284
1 1293
1 1305
1 1324
1 1338
1 1344
1 1351
1 1360
1 1361
1 1362
1 1364
1 1379
1 1380
1 1404
1 1428
1 1452
1 1455
1 1457
1 14...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #29:

score: 0
Accepted
time: 227ms
memory: 50784kb

input:

1000 953530 1002
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1011
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1040
1 1041
1 1042
1 1043
1 1044
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #30:

score: 0
Accepted
time: 174ms
memory: 50660kb

input:

999 998001 1001
1 1000
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1039
1 10...

output:

12
AAAAAAAAAAAA
AAAAAAAAAAAB
AAAAAAAAAABA
AAAAAAAAAABB
AAAAAAAAABAA
AAAAAAAAABAB
AAAAAAAAABBA
AAAAAAAAABBB
AAAAAAAABAAA
AAAAAAAABAAB
AAAAAAAABABA
AAAAAAAABABB
AAAAAAAABBAA
AAAAAAAABBAB
AAAAAAAABBBA
AAAAAAAABBBB
AAAAAAABAAAA
AAAAAAABAAAB
AAAAAAABAABA
AAAAAAABAABB
AAAAAAABABAA
AAAAAAABABAB
AAAAAAABABB...

result:

ok correct

Test #31:

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

input:

999 1 1001
961 1041

output:

22
ABAAAAAAAAAACCCCCCCCCC
ABAAAAAAAAABCCCCCCCCCC
ABAAAAAAAABACCCCCCCCCC
ABAAAAAAAABBCCCCCCCCCC
ABAAAAAAABAACCCCCCCCCC
ABAAAAAAABABCCCCCCCCCC
ABAAAAAAABBACCCCCCCCCC
ABAAAAAAABBBCCCCCCCCCC
ABAAAAAABAAACCCCCCCCCC
ABAAAAAABAABCCCCCCCCCC
ABAAAAAABABACCCCCCCCCC
ABAAAAAABABBCCCCCCCCCC
ABAAAAAABBAACCCCCCCCC...

result:

ok correct

Test #32:

score: 0
Accepted
time: 89ms
memory: 29956kb

input:

1000 553460 1002
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1039
1 1040
1 1...

output:

33
ABBBBBBBBBBBBBBBBBBAAAAAAACCCCCCC
ABBBBBBBBBBBBBBBBBBAAAAAABCCCCCCC
ABBBBBBBBBBBBBBBBBBAAAAABACCCCCCC
ABBBBBBBBBBBBBBBBBBAAAAABBCCCCCCC
ABBBBBBBBBBBBBBBBBBAAAABAACCCCCCC
ABBBBBBBBBBBBBBBBBBAAAABABCCCCCCC
ABBBBBBBBBBBBBBBBBBAAAABBACCCCCCC
ABBBBBBBBBBBBBBBBBBAAAABBBCCCCCCC
ABBBBBBBBBBBBBBBBBBAAABAA...

result:

ok correct

Test #33:

score: 0
Accepted
time: 91ms
memory: 32036kb

input:

1000 596219 1002
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1039
1 1040
1 1...

output:

23
ABBBBBBBBAAAAAAACCCCCCC
ABBBBBBBBAAAAAABCCCCCCC
ABBBBBBBBAAAAABACCCCCCC
ABBBBBBBBAAAAABBCCCCCCC
ABBBBBBBBAAAABAACCCCCCC
ABBBBBBBBAAAABABCCCCCCC
ABBBBBBBBAAAABBACCCCCCC
ABBBBBBBBAAAABBBCCCCCCC
ABBBBBBBBAAABAAACCCCCCC
ABBBBBBBBAAABAABCCCCCCC
ABBBBBBBBAAABABACCCCCCC
ABBBBBBBBAAABABBCCCCCCC
ABBBBBBBB...

result:

ok correct

Test #34:

score: 0
Accepted
time: 114ms
memory: 30152kb

input:

1000 534078 1002
1 1011
1 1012
2 1011
2 1012
1 1016
1 1017
2 1016
2 1017
1 1020
1 1021
1 1022
2 1020
2 1021
2 1022
1 1023
1 1024
1 1025
1 1026
2 1023
2 1024
2 1025
2 1026
1 1027
1 1028
2 1027
2 1028
1 1029
1 1030
1 1031
1 1032
2 1029
2 1030
2 1031
2 1032
1 1033
1 1034
1 1035
1 1036
2 1033
2 1034
2 1...

output:

341
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #35:

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

input:

2 1 4
2 3

output:

3
ABA
BAA
CAB
CCB

result:

ok correct

Subtask #5:

score: 18
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #36:

score: 18
Accepted
time: 140ms
memory: 31140kb

input:

1000 534730 1001
1 1002
1 1007
1 1009
1 1011
1 1013
1 1021
1 1022
1 1023
1 1024
1 1026
1 1028
1 1029
1 1030
1 1035
1 1036
1 1038
1 1041
1 1042
1 1045
1 1050
1 1054
1 1057
1 1060
1 1062
1 1064
1 1065
1 1067
1 1068
1 1070
1 1071
1 1074
1 1075
1 1076
1 1077
1 1079
1 1081
1 1084
1 1088
1 1090
1 1091
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #37:

score: 0
Accepted
time: 37ms
memory: 9380kb

input:

1000 69417 1001
1 1004
1 1021
1 1047
1 1048
1 1053
1 1059
1 1064
1 1066
1 1073
1 1109
1 1132
1 1133
1 1157
1 1162
1 1171
1 1172
1 1173
1 1174
1 1184
1 1187
1 1198
1 1227
1 1234
1 1257
1 1269
1 1270
1 1284
1 1295
1 1300
1 1322
1 1336
1 1340
1 1346
1 1367
1 1375
1 1387
1 1389
1 1395
1 1405
1 1413
1 14...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #38:

score: 0
Accepted
time: 217ms
memory: 50828kb

input:

1000 953296 1001
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1039
1 1040
1 1041
1 1042
1 1...

output:

1001
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #39:

score: 0
Accepted
time: 182ms
memory: 50876kb

input:

1000 1000000 1001
1 1001
1 1002
1 1003
1 1004
1 1005
1 1006
1 1007
1 1008
1 1009
1 1010
1 1011
1 1012
1 1013
1 1014
1 1015
1 1016
1 1017
1 1018
1 1019
1 1020
1 1021
1 1022
1 1023
1 1024
1 1025
1 1026
1 1027
1 1028
1 1029
1 1030
1 1031
1 1032
1 1033
1 1034
1 1035
1 1036
1 1037
1 1038
1 1039
1 1040
1 ...

output:

12
AAAAAAAAAAAA
AAAAAAAAAAAB
AAAAAAAAAABA
AAAAAAAAAABB
AAAAAAAAABAA
AAAAAAAAABAB
AAAAAAAAABBA
AAAAAAAAABBB
AAAAAAAABAAA
AAAAAAAABAAB
AAAAAAAABABA
AAAAAAAABABB
AAAAAAAABBAA
AAAAAAAABBAB
AAAAAAAABBBA
AAAAAAAABBBB
AAAAAAABAAAA
AAAAAAABAAAB
AAAAAAABAABA
AAAAAAABAABB
AAAAAAABABAA
AAAAAAABABAB
AAAAAAABABB...

result:

ok correct

Test #40:

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

input:

1000 1 1001
951 1051

output:

22
ABAAAAAAAAAACCCCCCCCCC
ABAAAAAAAAABCCCCCCCCCC
ABAAAAAAAABACCCCCCCCCC
ABAAAAAAAABBCCCCCCCCCC
ABAAAAAAABAACCCCCCCCCC
ABAAAAAAABABCCCCCCCCCC
ABAAAAAAABBACCCCCCCCCC
ABAAAAAAABBBCCCCCCCCCC
ABAAAAAABAAACCCCCCCCCC
ABAAAAAABAABCCCCCCCCCC
ABAAAAAABABACCCCCCCCCC
ABAAAAAABABBCCCCCCCCCC
ABAAAAAABBAACCCCCCCCC...

result:

ok correct

Test #41:

score: 0
Accepted
time: 86ms
memory: 27580kb

input:

1000 501716 1001
1 1449
1 1450
1 1451
1 1452
1 1453
1 1454
1 1455
1 1456
1 1457
1 1458
1 1459
1 1460
1 1461
1 1462
1 1463
1 1464
1 1465
1 1466
1 1467
1 1468
1 1469
1 1470
1 1471
1 1472
1 1473
1 1474
1 1475
1 1476
1 1477
1 1478
1 1479
1 1480
1 1481
1 1482
1 1483
1 1484
1 1485
1 1486
1 1487
1 1488
1 1...

output:

32
ABBBBBBBBBBBBBBBBBBBAAAAAACCCCCC
ABBBBBBBBBBBBBBBBBBBAAAAABCCCCCC
ABBBBBBBBBBBBBBBBBBBAAAABACCCCCC
ABBBBBBBBBBBBBBBBBBBAAAABBCCCCCC
ABBBBBBBBBBBBBBBBBBBAAABAACCCCCC
ABBBBBBBBBBBBBBBBBBBAAABABCCCCCC
ABBBBBBBBBBBBBBBBBBBAAABBACCCCCC
ABBBBBBBBBBBBBBBBBBBAAABBBCCCCCC
ABBBBBBBBBBBBBBBBBBBAABAAACCCCCC
...

result:

ok correct

Test #42:

score: 0
Accepted
time: 80ms
memory: 27196kb

input:

1000 495973 1001
1 1415
1 1416
1 1417
1 1418
1 1419
1 1420
1 1421
1 1422
1 1423
1 1424
1 1425
1 1426
1 1427
1 1428
1 1429
1 1430
1 1431
1 1432
1 1433
1 1434
1 1435
1 1436
1 1437
1 1438
1 1439
1 1440
1 1441
1 1442
1 1443
1 1444
1 1445
1 1446
1 1447
1 1448
1 1449
1 1450
1 1451
1 1452
1 1453
1 1454
1 1...

output:

24
ABBBBBBBBBAAAAAAACCCCCCC
ABBBBBBBBBAAAAAABCCCCCCC
ABBBBBBBBBAAAAABACCCCCCC
ABBBBBBBBBAAAAABBCCCCCCC
ABBBBBBBBBAAAABAACCCCCCC
ABBBBBBBBBAAAABABCCCCCCC
ABBBBBBBBBAAAABBACCCCCCC
ABBBBBBBBBAAAABBBCCCCCCC
ABBBBBBBBBAAABAAACCCCCCC
ABBBBBBBBBAAABAABCCCCCCC
ABBBBBBBBBAAABABACCCCCCC
ABBBBBBBBBAAABABBCCCCC...

result:

ok correct

Test #43:

score: 0
Accepted
time: 113ms
memory: 30028kb

input:

1000 535314 1001
1 1005
2 1005
1 1006
1 1007
1 1008
2 1006
2 1007
2 1008
1 1011
1 1012
2 1011
2 1012
1 1014
2 1014
1 1015
1 1016
2 1015
2 1016
1 1019
1 1020
2 1019
2 1020
1 1021
1 1022
2 1021
2 1022
1 1026
1 1027
2 1026
2 1027
1 1028
2 1028
1 1037
2 1037
1 1038
1 1039
1 1040
1 1041
2 1038
2 1039
2 1...

output:

506
ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok correct

Test #44:

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

input:

13 81 14
1 17
1 18
1 19
1 20
1 23
1 24
2 14
2 17
2 18
2 21
2 22
2 24
3 17
3 18
3 19
3 20
3 21
3 24
4 14
4 16
4 20
4 22
4 24
4 25
4 26
5 14
5 18
5 19
5 22
5 24
6 21
6 23
6 24
6 26
7 15
7 17
7 18
7 21
7 23
7 24
7 26
8 16
8 17
8 19
8 20
8 21
8 22
8 25
9 14
9 16
9 20
9 22
9 24
9 25
9 26
10 15
10 17
10 2...

output:

14
ABBBBBBBBBBBAC
BABBBBBBBBBBAC
BBABBBBBBBBBAC
BBBABBBBBBBBAC
BBBBABBBBBBBAC
BBBBBABBBBBBAC
BBBBBBABBBBBAC
BBBBBBBABBBBAC
BBBABBBBBBBBBC
BBBBBBBBABBBAC
BBBBBBBBBABBAC
BBBBBBBBBBABAC
BBBBBBBBBBBAAC
CACAACCCCCACCA
CCCCCCACAACCCA
CCCACCCACACCCA
AAACCCAAAAACCA
AAACACACCACACA
ACACACCACCACCA
ACAACCCAAAAC...

result:

ok correct

Test #45:

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

input:

14 95 15
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 24
1 26
1 27
2 15
2 17
2 19
2 21
2 24
3 15
3 16
3 17
3 19
3 20
3 25
3 26
3 27
3 28
4 16
4 17
4 18
4 19
4 20
4 25
4 27
4 28
5 16
5 19
5 20
5 22
5 23
5 24
5 27
6 19
6 21
6 22
6 24
7 15
7 16
7 18
7 19
7 21
7 22
7 23
7 26
8 19
8 21
8 24
8 25
8 28
9 16
9 17
9...

output:

15
ABBBBBBBBBBBBAC
BABBBBBBBBBBBAC
BBABBBBBBBBBBAC
BBBABBBBBBBBBAC
BBBBABBBBBBBBAC
BBBBBABBBBBBBAC
BBBBBBABBBBBBAC
BBBBBBBABBBBBAC
BBBBBBBBABBBBAC
BBBBBBBBBABBBAC
BBBBBBBBBBABBAC
BBBBABBBBBBBBBC
BBBBBBBBBBBABAC
BBBBBBBBBBBBAAC
AAACCCACCAACACA
ACAAACACACCCCCA
AAAACCCCACAACCA
ACCACCACACAACCA
AAAAAAAAA...

result:

ok correct

Test #46:

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

input:

15 125 16
1 17
1 20
1 21
1 22
1 24
1 25
1 26
1 27
1 28
2 16
2 18
2 19
2 20
2 24
2 26
2 27
2 28
2 30
3 18
3 19
3 20
3 23
3 25
3 26
3 27
3 28
3 29
3 30
4 17
4 18
4 19
4 24
4 25
4 30
5 17
5 21
5 22
5 23
5 25
5 26
5 27
5 28
6 16
6 17
6 21
6 23
6 24
6 25
6 26
6 27
6 29
6 30
7 17
7 18
7 19
7 22
7 23
7 24
...

output:

16
ABBBBBBBBBBBBBAC
BABBBBBBBBBBBBAC
BBABBBBBBBBBBBAC
BBBABBBBBBBBBBAC
BBBBABBBBBBBBBAC
BBBBBABBBBBBBBAC
BBBBBBABBBBBBBAC
BBBBBBBABBBBBBAC
BBBBBBBBABBBBBAC
BBBBBBBBBABBBBAC
BBBBBBBBBBABBBAC
BBBBBBBBBBBABBAC
BBBBBBBBBBBBABAC
BBBBBBBBBBBBBAAC
ABBBBBBBBBBBBBBC
CACCCACACCCCAACA
ACCAAAAACAACCACA
CAAACCAC...

result:

ok correct

Test #47:

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

input:

2 1 3
2 3

output:

3
ABA
BAA
CAB
CCB

result:

ok correct

Test #48:

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

input:

3 9 4
1 4
1 5
1 6
2 4
2 5
2 6
3 4
3 5
3 6

output:

4
AAAA
AAAB
AABA
AABB
ABAA
ABAB

result:

ok correct

Extra Test:

score: 0
Extra Test Passed