QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746201#5596. I Could Have Woni24AC ✓16ms3816kbC++141.1kb2024-11-14 13:49:362024-11-14 13:49:37

Judging History

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

  • [2024-11-14 13:49:37]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:3816kb
  • [2024-11-14 13:49:36]
  • 提交

answer

// File generated on 24/11/13 21:39 by Anand

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

#define fastio ios::sync_with_stdio(false); cin.tie(0)
#define rep(i, m, n)  for (long long i = m; i < n; i++)
#define DEBUG(x) cout << "debug: " << x << "\n"
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define pb push_back
#define sz size

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vec;
typedef vector<vec> vecc;
typedef vector<pll> vecp;

void SOLVE() {
    string s;
    cin >> s;
    ll n = s.size();
    ll x = 0;
    vec y;
    rep(i,1,n+1) {
        ll a = 0, b = 0;
        ll ac = 0, bc = 0;
        rep(j, 0, n) {
            if (ac >= i) {a++; ac = 0; bc = 0;}
            if (bc >= i) {b++; ac = 0; bc = 0;}
            if (s[j] == 'A') ac++;
            else bc++;
        }
        if (ac >= i) a++;
        if (bc>=i) b++;
        if (a > b) y.pb(i);
    }
    cout << y.size() << "\n";
    for(auto& i : y) cout << i << " ";
    cout<< "\n";
}

signed main() {
    fastio;


		SOLVE();

    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

BBAAABABBAAABB

output:

3
3 6 7 

result:

ok 2 lines

Test #2:

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

input:

AABBBAAB

output:

2
2 4 

result:

ok 2 lines

Test #3:

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

input:

A

output:

1
1 

result:

ok 2 lines

Test #4:

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

input:

B

output:

0


result:

ok single line: '0'

Test #5:

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

input:

ABAABBAAABBBAAAABBBBAAAAABBBBBAAAAAABBBBBBAAAAAAABBBBBBBAAAAAAAABBBBBBBBAAAAAAAAABBBBBBBBBAAAAAAAAAABBBBBBBBBBAAAAAAAAAAABBBBBBBBBBB

output:

52
3 4 5 7 8 9 11 13 14 16 17 18 21 22 25 26 27 29 30 31 32 33 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 

result:

ok 2 lines

Test #6:

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

input:

BABBAABBBAAABBBBAAAABBBBBAAAAABBBBBBAAAAAABBBBBBBAAAAAAABBBBBBBBAAAAAAAABBBBBBBBBAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBBBBBBBBAAAAAAAAAAABBBBBBBBBBBBAAAAAAAAAAAA

output:

4
6 10 15 28 

result:

ok 2 lines

Test #7:

score: 0
Accepted
time: 16ms
memory: 3604kb

input:

BAAABBABABABBBBABBAABABBAAABBBBAABBBBABBBBABABBAABAAABBAABAABBBAABABBAAAABBBBBAABBBBAAAAABAABBAAAAABBBABAABAABBABBAABBBBAABABBBBBBBAABBBAAAAABBBBBBAABBABABABBBBABBAABABBAABBBABABAABBBAABAABAABABBBBAAABBAABABAAAABABBABAABAABAABBBABBBAABBABBAABAABABABBABBBABBBAABBAABBBBBAAABABAABBBBABBBBABAAABBABBABAA...

output:

7
13 55 70 114 115 116 332 

result:

ok 2 lines

Test #8:

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

input:

ABBAABBBAAABBBBAAAABBBBBAAAAABBBBBBAAAAAA

output:

4
1 3 15 21 

result:

ok 2 lines

Test #9:

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

input:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

2000
1 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...

result:

ok 2 lines

Test #10:

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

input:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

0


result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 16ms
memory: 3608kb

input:

BBBBAABABAAAAABBBABAAABBBABAABAABABBBBABBBBABBBBBBABAABBBBABBABAABABBABABABBABBABBABBABBABBABBAABAAABABBAABBAABABBBBBBAABBBABBBBBBBABBABBBBBAABAAAAABABAAAABAAAAABABABBAABBBABAABBBAABABAABAAAAABBAABBBABBAAAAAABABABAABBABABBAABBBBBBBBBABBBABBBBBBABBABABBAAABBBBBBBAAABABAAAAAAAABBAABBBBBBAABBBAABBBAABA...

output:

7
17 24 55 74 112 149 150 

result:

ok 2 lines

Test #12:

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

input:

ABBBBBBAABBAAABAAABBBBBBABABABBBABABAAABAABBBBBABAAABAAAAABBAAAAABBBABBBABABABBBAAAAABBAAABABABBAAABAABBBBAAABBBAABABBBBABBBBABBAABBBBABBBBABAABBBBABABBBABABABBAABBABABBBABABBBBAABABBBAAABAABABBAABABBBAAABABBBBBAABBBABABBBBABBABBABAAABBBBBAABAAAAAAABBBBAABBABBABBBABAABBABABBABABAABBBABBAAAABBBABBAAB...

output:

51
20 23 26 29 36 37 39 50 51 52 67 68 77 78 79 80 106 107 108 110 111 112 133 134 135 136 137 158 159 160 161 164 165 166 167 168 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 

result:

ok 2 lines

Test #13:

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

input:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

output:

5
1 3 9 27 81 

result:

ok 2 lines

Test #14:

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

input:

ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

output:

2
1 80 

result:

ok 2 lines

Test #15:

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

input:

ABBBBBBBBBBBBBBBBBBBBAABBBBBBBBBBBBBBBBBBBBBAAABBBBBBBBBBBBBBBBBBBBBBBBBAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA

output:

0


result:

ok single line: '0'

Test #16:

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

input:

ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB...

output:

138
2 4 9 10 11 12 15 18 21 22 26 27 28 29 34 35 36 37 38 39 40 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 134 135 136 137 138 139 140 141 142 143 144 145 146 1...

result:

ok 2 lines

Test #17:

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

input:

BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

output:

148
1 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 ...

result:

ok 2 lines

Test #18:

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

input:

AABABBABAAAABBAABABBABBBBABBBBABBBAAAAAAABABABBABBABBAABBABBBBABABAAABAAABBABBAAAABABAAABAABABAAABABABBABAAAABAABBABAAABABAABAABAAAAAAABBBBABABBABBBBAAAABAAAA

output:

73
1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 

result:

ok 2 lines