QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#794295#9801. Dot Product Gameucup-team055#AC ✓371ms11336kbC++204.6kb2024-11-30 13:28:352024-11-30 13:28:35

Judging History

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

  • [2024-11-30 13:28:35]
  • 评测
  • 测评结果:AC
  • 用时:371ms
  • 内存:11336kb
  • [2024-11-30 13:28:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll ILL=2167167167167167167;
const int INF=2100000000;
#define rep(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define all(p) p.begin(),p.end()
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});}
bool yneos(bool a,bool upp=0){if(a){cout<<(upp?"YES\n":"Yes\n");}else{cout<<(upp?"NO\n":"No\n");}return a;}
template<class T> void vec_out(vector<T> &p,int ty=0){
    if(ty==2){cout<<'{';for(int i=0;i<(int)p.size();i++){if(i){cout<<",";}cout<<'"'<<p[i]<<'"';}cout<<"}\n";}
    else{if(ty==1){cout<<p.size()<<"\n";}for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout<<p[i];}cout<<"\n";}}
template<class T> T vec_min(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmin(ans,x);return ans;}
template<class T> T vec_max(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmax(ans,x);return ans;}
template<class T> T vec_sum(vector<T> &a){T ans=T(0);for(auto &x:a) ans+=x;return ans;}
int pop_count(long long a){int res=0;while(a){res+=(a&1),a>>=1;}return res;}

namespace po167{
    template <class T>
    struct seg_sum{
        int n;
        int seg_size;
        std::vector<T> seg;
        T e;
        //要素数、単位元 typeは+演算が定義されているもの
        seg_sum(int k,T e_in){
            e=e_in;
            n=k;
            seg_size=1;
            while(seg_size<n) seg_size*=2;
            seg.resize(seg_size*2-1);
            for(int i=0;i<seg_size*2-1;i++) seg[i]=e;
        }

        T sum_sub(int a,int b,int l,int r,int k){
            if(r<=a||b<=l) return e;
            if(a<=l&&r<=b) return seg[k];
            T X=sum_sub(a,b,l,(l+r)/2,k*2+1);
            T Y=sum_sub(a,b,(l+r)/2,r,k*2+2);
            return X+Y;
        }
        T sum(int a,int b){
            //assert(0<=a&&b<n);
            return sum_sub(a,b,0,seg_size,0);
        }
        T get(int index){
            assert(0<=index&&index<n);
            return seg[seg_size-1+index];
        }
        void insert(int index,T a){
            assert(0<=index&&index<n);
            int now_index=index+seg_size-1;
            seg[now_index]=a;
            while(now_index!=0){
                now_index-=1;
                now_index/=2;
                seg[now_index]=seg[now_index*2+1]+seg[now_index*2+2];
            }
        }
    };

//qのなかみは、0~nの順列の並び替えである必要がある
    long long inversion_permutation(std::vector<int> &q){
        int n=q.size();
        po167::seg_sum<int> S(n,0);
        long long ans=0;
        for(int i=0;i<n;i++){
            assert(0<=q[i]&&q[i]<n);
            assert(S.get(q[i])==0);
            ans+=S.sum(q[i],n);
            S.insert(q[i],1);
        }
        return ans;
    }
    template <class T>
//pのなかみは、重複ありで内容が同じならおけ
//比較ができる必要がある。
    long long inversion_vector(std::vector<T> &p){
        int n=p.size();
        std::vector<int> q(n);
        for(int i=0;i<n;i++) q[i]=i;
        sort(q.begin(),q.end(),[&](int l,int r){
            if(p[l]==p[r]) return l<r;
            return p[l]<p[r];
        });
        return inversion_permutation(q);
    }

}
using po167::inversion_permutation;
using po167::inversion_vector;
using po167::seg_sum;

void solve();
// CITRUS CURIO CITY / FREDERIC
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t;
    rep(i, 0, t) solve();
}

void solve(){
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    rep(i, 0, N) cin >> A[i], A[i]--;
    rep(i, 0, N) cin >> B[i], B[i]--;
    ll ans = 0;
    ans ^= (po167::inversion_permutation(A) & 1);
    ans ^= (po167::inversion_permutation(B) & 1);
    string S;
    rep(i, 0, N){
        S += (char)('B' - ans);
        if (i + 1 != N){
            char c;
            int l, r, d;
            cin >> c >> l >> r >> d;
            if (d & 1){
                if ((r - l) & 1) ans ^= 1;
            }
        }
    }
    cout << S << "\n";
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3656kb

input:

5
3
1 2 3
1 2 3
A 1 1 1
B 1 1 1
3
1 2 3
2 1 3
A 1 2 1
B 2 2 1
3
1 2 3
2 1 3
A 1 3 1
B 1 2 1
3
1 2 3
3 2 1
A 2 2 1
B 2 3 1
10
1 2 3 4 5 6 7 8 9 10
4 2 3 9 6 1 5 8 7 10
A 2 9 10
B 2 7 9
A 1 10 8
B 4 6 7
B 3 10 6
A 2 5 5
A 8 9 4
B 3 9 3
A 2 7 2

output:

BBB
ABB
AAB
AAB
AABBBBAAAA

result:

ok 5 tokens

Test #2:

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

input:

100000
7
7 4 6 3 5 1 2
4 2 6 1 5 3 7
A 2 6 7
A 3 3 7
A 4 5 6
A 3 6 3
A 2 5 5
A 2 3 1
3
1 2 3
3 1 2
B 1 1 1
A 1 3 3
6
1 6 3 4 2 5
6 3 2 4 1 5
B 6 6 5
B 3 5 4
B 1 6 6
A 2 5 2
B 2 5 5
10
8 7 10 2 5 3 1 9 6 4
10 2 8 9 1 5 7 3 6 4
B 3 3 2
B 3 10 7
B 4 8 2
B 3 7 4
A 3 4 9
B 5 6 8
B 6 8 7
B 3 6 1
B 6 8 3
7...

output:

AAAABAB
BBB
AAAAAB
BBAAABBBAA
ABABABA
ABAAAA
BBA
BBAABBAA
BBBBBBBA
ABB
ABBBBBBB
BA
BBB
BBBA
AAAAA
AAAABB
BBBBB
ABBB
BBBAAABB
BBBA
BBBABB
BB
AAB
BBBBA
AAA
AABBBB
BBBBB
BBBBBBBB
AAA
AABB
ABBBAA
BBBB
ABBAA
AABBBBBB
ABBB
AAAAAA
AAAAAAAA
BBB
AA
ABBBAA
AAAB
AAAAAAA
ABBBB
AAB
BAA
AAABBB
BBBBB
BBBABBA
BABBB...

result:

ok 100000 tokens

Test #3:

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

input:

100000
7
5 6 2 7 3 1 4
4 6 7 2 5 3 1
A 4 6 6
B 3 6 6
A 1 5 6
B 5 7 7
B 1 4 1
B 2 7 1
6
2 6 5 1 4 3
5 1 6 3 2 4
B 4 5 6
A 3 6 3
B 2 5 5
A 1 4 3
B 3 5 6
3
2 3 1
3 1 2
A 1 3 3
A 2 3 1
3
2 3 1
2 3 1
B 3 3 2
A 1 1 2
9
5 6 2 4 7 9 1 8 3
1 8 2 4 7 3 6 9 5
A 2 8 4
A 3 3 6
A 1 9 7
B 1 4 7
A 7 8 8
A 3 6 6
A 1...

output:

BBBBBAB
AABABB
BBA
BBB
AAAABBBAA
BBB
BBBBBB
BB
ABBA
AA
AABA
BBAAAA
ABBBBA
BBBBABBA
B
AAABBB
BBBBBBAA
AAA
ABABBAA
AAABBAA
BBBA
BBBBBAABB
BBAABBB
AA
BBBB
BBB
BBBBA
AABBB
ABB
AB
BBAAAABB
AAAABAA
BBBAAA
BA
AAAABB
ABBABAAA
AAAB
AAABA
AAB
BABBBB
AAAAABA
ABBBA
AAAAAAAA
BAAA
AAAA
BAAA
AAAAAAA
BBBBAAA
AAB
BB...

result:

ok 100000 tokens

Test #4:

score: 0
Accepted
time: 106ms
memory: 3888kb

input:

100000
3
1 2 3
3 1 2
A 1 3 1
A 2 3 3
7
6 7 1 4 3 2 5
7 1 2 5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AAAAA
AABAA
ABAAAAAB
BBBBB
BA
AAAAAAAAA
ABAAA
BABBB
BA
BBAA
BBBA
BBB
AAABBBBB
BBBB
BAAAA
ABAAABB
AAAA
AABA
BAABBB
BBBBAAAA
BA
BBA
AAAAAAA
BAABB
A...

result:

ok 100000 tokens

Test #6:

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

input:

100000
7
3 4 1 6 2 7 5
4 5 2 7 3 1 6
B 3 7 4
A 6 7 5
B 5 7 6
A 2 5 4
A 3 5 4
B 2 7 1
5
1 4 3 2 5
2 5 4 3 1
B 1 2 5
B 3 4 4
A 3 5 1
A 2 4 5
3
2 1 3
1 3 2
A 1 3 2
A 2 3 2
5
2 5 4 3 1
1 4 3 2 5
B 1 2 3
A 2 5 3
A 1 2 1
A 1 5 3
3
3 2 1
1 3 2
B 2 3 3
B 1 2 1
7
7 5 3 6 4 1 2
1 6 4 7 5 2 3
B 2 7 7
B 1 3 2
B...

output:

BBAAAAB
BAAAA
BBB
BABAA
BAB
BAABBAA
BBBAB
BBAABBB
AABBBA
BBAAA
BAB
BAAAA
AB
BAAAABA
ABBA
BBB
AAAA
AABA
BBBBAAB
BBBBAAA
ABAB
AABA
BABBB
AAAABB
AAAA
BBAABAB
BBABB
BABAAAA
BBB
AAAABB
AAAAAABB
AAABBA
AAAAAA
BBAAA
BBBAB
AABA
AA
BBBBA
AAAA
ABAA
AABAAA
BAABBBBBA
BBBBA
BBBBBBA
AAABBBBBAA
B
AAAAAA
BBB
AA
BBA...

result:

ok 100000 tokens

Test #7:

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

input:

100000
4
1 2 3 4
2 3 1 4
B 2 4 1
B 3 4 2
A 2 3 4
6
5 3 6 2 4 1
4 5 1 2 3 6
A 2 5 3
B 1 6 6
A 2 4 1
B 1 6 4
B 1 5 4
4
1 2 3 4
4 1 2 3
A 2 2 3
A 1 4 3
B 1 4 2
7
4 1 5 2 6 3 7
5 2 3 4 1 6 7
B 2 4 6
B 4 5 7
A 5 7 4
B 1 3 5
B 2 7 6
B 5 5 3
4
3 1 4 2
2 1 4 3
A 1 3 1
A 2 3 3
B 1 2 2
6
5 1 4 3 2 6
5 1 6 2 4...

output:

BBBB
ABBBBB
AABB
AABBBBB
AABB
ABBBBB
AABAA
BBBA
BAAAAA
BABAAB
BBBAA
AAB
AABBABB
BAAA
AAAABA
AAAAA
BBBBB
BBBAAAAAA
ABABBAA
BBA
BBBAAA
BBB
BBAAB
BBBBAAB
AB
BBBBBBB
AAABBB
ABBB
AAAB
AAAAA
AAA
BBBAA
BABB
BAABAAAA
BAAA
BBBBB
AAAAB
AAA
AAA
BBBAAAA
B
BBAABBBA
ABA
BBABB
AAABB
ABBBBBB
BBABBBAA
AAAAA
BBBA
BBA...

result:

ok 100000 tokens

Test #8:

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

input:

100000
4
4 3 2 1
1 4 3 2
B 3 4 4
B 1 2 1
A 3 4 2
4
4 3 1 2
3 2 4 1
B 1 4 4
B 2 4 3
B 3 4 3
4
1 4 2 3
4 3 1 2
B 2 3 1
A 1 4 3
A 2 3 4
6
4 6 5 2 1 3
5 1 6 3 2 4
B 5 6 5
A 2 6 4
A 1 2 5
A 4 5 4
A 1 3 1
5
2 3 1 5 4
3 4 2 1 5
B 1 3 1
A 1 4 4
A 2 3 5
A 1 3 2
8
8 3 1 5 6 2 4 7
1 4 2 6 7 3 5 8
A 1 3 7
A 1 4...

output:

AABB
AAAB
ABAA
ABBAAA
BBBAA
AAABAAAA
BBBBB
BAABBBBBB
AAAAAAAAAB
AAAB
BBA
BBBBB
BAABB
BBBBBAB
AAABAA
AABB
BAA
AABAABBBBB
BBBBA
AAAB
AABBBB
BAAAA
BBA
AAABBB
BBBBA
AAAABB
AABBBBBA
ABBB
BBABA
AAAAAA
AAAAABBA
AABA
AA
ABBB
BBBBA
AB
ABBBBB
BAAAA
AAAABA
AAABBB
BBAAAAA
BAA
AAAABB
ABBA
ABABBA
AAAAAB
AAAA
AABA...

result:

ok 100000 tokens

Test #9:

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

input:

100000
8
3 5 7 6 8 1 4 2
2 7 6 3 4 1 5 8
A 3 3 7
A 3 7 4
A 1 4 3
A 5 7 3
B 8 8 7
A 1 8 5
A 1 4 7
7
1 2 5 7 6 4 3
5 4 2 7 1 6 3
A 3 3 4
A 5 7 1
A 2 5 7
B 5 7 7
B 2 7 1
A 2 5 2
6
3 1 2 5 4 6
6 4 1 3 2 5
A 2 6 5
A 1 6 3
B 5 6 2
A 1 6 2
A 4 4 5
4
4 1 3 2
4 3 1 2
B 2 3 1
B 2 3 4
B 3 4 1
5
4 2 1 3 5
1 5 2...

output:

BBBAAABA
BBBAABB
BBAAAA
ABBA
AABBB
AAAAB
BBB
AABBBAAAAB
BAAA
ABBB
BAABAAAB
ABAA
ABBBA
B
BBA
BB
AABBBBB
BBAAB
BBBBA
AAAAAAA
BBBB
AAAAAA
ABBAA
BBBAA
BBBABAA
BBAAAAB
AAAABBB
BBB
BAAAAA
AAAAAAA
BA
BABBBB
BB
BAAAA
BA
BBBBBBB
AABBB
ABBAB
BB
AAAAABB
AAAB
BA
BBAAAAAA
BBA
BBB
B
BBABBABBAAA
AAAA
AAAAABBBBB
AA...

result:

ok 100000 tokens

Test #10:

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

input:

100000
5
1 2 3 4 5
2 3 4 5 1
A 3 4 4
B 1 3 5
A 2 4 1
B 1 5 2
5
1 4 2 3 5
2 5 3 4 1
A 4 5 5
A 2 4 3
A 2 4 3
A 4 5 1
10
8 9 5 7 2 3 10 6 1 4
7 8 4 6 1 2 9 5 10 3
B 1 9 5
B 3 7 10
B 2 10 4
A 4 7 2
B 3 6 3
A 2 4 9
B 5 7 4
A 3 8 9
A 3 10 8
7
5 3 4 7 6 1 2
6 4 5 1 7 2 3
B 1 2 4
B 3 7 2
B 3 4 1
A 1 6 6
B 4...

output:

BBBBB
BAAAB
AAAAABBBAA
BBBAABB
BBBBBBA
AAAABA
BBBABAA
AA
AB
AAAA
BBABBAAAAAB
ABBAAB
BBAAA
ABBB
AAAA
AAAB
AABB
AA
AAABBBBB
BBA
BBBAA
BBBAA
AAAAABAA
BBBABBBBB
BBBAA
AAABBB
ABBA
AABBAB
ABBBBBAB
AAAB
BAA
AABB
BBBBB
AABA
BAA
BBB
BBBBBAB
AA
B
BABBA
BBBBABB
AB
ABAA
BBB
AB
B
BABAA
AAAA
AA
AABB
AABB
BBAAA
B
...

result:

ok 100000 tokens

Test #11:

score: 0
Accepted
time: 112ms
memory: 3576kb

input:

100000
9
4 8 5 1 2 9 3 7 6
8 2 6 7 5 4 9 3 1
A 4 9 2
B 2 5 8
A 1 7 7
B 5 5 3
B 5 8 8
B 2 9 7
B 7 7 8
B 3 5 1
4
2 1 3 4
2 4 3 1
A 1 3 1
A 1 4 2
A 2 3 1
2
1 2
1 2
B 1 2 2
4
4 2 1 3
2 1 4 3
A 2 4 1
B 1 3 1
A 2 2 3
5
1 2 4 3 5
3 4 1 2 5
A 1 2 2
A 1 3 1
A 2 5 4
B 2 5 2
2
2 1
1 2
A 1 2 2
3
3 1 2
2 1 3
B 3...

output:

BBBBBBAAA
AAAB
BB
BBBB
AAAAA
AA
AAA
AABBBABB
AABBBBBAA
BBBBBBA
AAB
ABABB
BBBB
ABBABBB
BABBB
BAAAAAB
BABBBAAA
BB
BBABAAA
BAAAABBBB
AAA
AAAABB
BBB
BABB
BBBB
ABABAA
AAAAAABB
ABB
AAAAABA
AAAAAB
ABAABB
BBBBAA
BBBBBBA
AAAAAB
BBABAAAAAAAAA
BBBA
BBBBAA
BBBB
BBBBB
BAAAB
BBBBBB
BABAA
ABBAAAA
BAABAAB
AABB
ABB
...

result:

ok 100000 tokens

Test #12:

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

input:

100000
2
1 2
2 1
A 1 2 2
4
4 2 3 1
1 3 4 2
B 2 3 3
A 2 4 2
B 1 3 1
6
5 4 3 1 6 2
4 3 2 6 5 1
B 3 4 4
B 1 6 4
A 5 6 5
B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
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
...

result:

ok 100000 tokens

Test #14:

score: 0
Accepted
time: 39ms
memory: 3664kb

input:

100000
2
2 1
1 2
A 2 2 2
2
1 2
1 2
A 1 1 2
2
1 2
1 2
A 1 1 1
2
1 2
1 2
B 2 2 2
2
1 2
2 1
A 1 2 2
2
1 2
1 2
A 1 1 1
2
1 2
2 1
A 1 1 2
2
2 1
2 1
B 1 2 1
2
1 2
2 1
A 1 1 2
2
2 1
2 1
A 2 2 1
2
1 2
2 1
B 1 1 1
2
2 1
1 2
B 1 2 1
2
1 2
1 2
A 1 2 2
2
2 1
1 2
B 1 2 2
2
2 1
1 2
A 1 1 2
2
1 2
1 2
A 1 1 1
2
2 1...

output:

AA
BB
BB
BB
AA
BB
AA
BA
AA
BB
AA
AB
BB
AA
AA
BB
BB
AB
BB
BB
AA
AB
AA
AB
BB
BB
AA
AA
AA
AA
AA
BB
AB
BB
AA
AA
BA
BB
AA
BB
AA
BB
AB
AA
BB
BB
BB
AA
AA
AA
BB
BB
BB
BB
BA
BA
BB
AA
AA
BB
BB
AA
AB
AA
BA
AA
BA
BB
BA
AA
AA
AA
AB
AA
BB
BB
BA
AA
AA
BA
AA
AA
BB
AB
AA
AA
BB
BB
AA
AA
BB
AB
AA
BB
BA
BB
BA
BA
AA
AA
...

result:

ok 100000 tokens

Test #15:

score: 0
Accepted
time: 62ms
memory: 3540kb

input:

100000
3
2 3 1
3 2 1
A 2 3 1
B 1 2 1
3
2 3 1
3 1 2
A 2 3 2
B 2 3 2
3
3 2 1
2 3 1
A 1 3 2
A 1 1 1
3
2 1 3
3 1 2
B 2 3 3
B 1 3 3
3
3 1 2
1 3 2
B 1 1 3
B 2 3 2
3
2 3 1
3 1 2
B 3 3 1
A 2 3 2
3
2 3 1
2 1 3
B 3 3 1
A 1 1 1
3
1 2 3
2 1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...

result:

ok 100000 tokens

Test #17:

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

input:

100000
5
4 3 1 5 2
2 3 1 4 5
A 1 2 2
A 2 5 5
B 2 4 4
A 2 5 2
5
5 3 2 1 4
5 1 2 4 3
B 3 5 4
A 3 5 2
B 1 2 2
B 1 1 5
5
5 3 2 1 4
1 4 3 2 5
A 1 4 3
B 1 1 5
A 1 4 5
B 3 4 1
5
3 5 2 4 1
3 1 2 4 5
B 1 4 3
B 1 2 3
A 3 4 5
A 2 3 5
5
1 4 3 2 5
4 1 5 3 2
A 4 5 3
B 1 4 3
B 3 5 2
A 2 2 3
5
2 1 4 3 5
5 2 1 3 4
A...

output:

BBAAA
BBBBB
BAABA
ABABA
ABAAA
AABBA
AAABB
AAAAA
AAAAA
BBBBB
BBABB
AAAAB
AAAAB
AAAAA
AAAAB
BBABB
BBBBB
AABBB
BBBBA
AAAAB
AAABA
BBABB
BBAAA
AAABA
BAAAA
BBBBB
ABBBA
AAAAA
ABBBA
BAABB
AAAAA
BBBAA
AABAA
AAAAB
BBABB
BABAB
AABAA
BABBB
BBBBB
AAAAA
BBBBA
ABAAA
AAABB
AAAAA
AAABB
AAAAA
AAAAA
BAAAA
BBBBB
AAABA
...

result:

ok 100000 tokens

Test #18:

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

input:

83333
6
5 3 1 6 4 2
4 5 3 6 1 2
B 2 3 5
B 3 3 1
B 2 6 2
A 4 5 3
A 3 3 1
6
2 5 6 4 3 1
4 1 5 3 6 2
A 2 4 3
B 1 6 3
B 1 3 4
B 1 4 5
B 4 4 1
6
2 5 3 1 6 4
1 6 5 2 3 4
A 1 5 5
B 3 5 2
A 2 6 1
B 6 6 6
A 3 4 6
6
2 3 1 5 6 4
1 4 6 5 2 3
B 2 4 3
B 1 2 6
A 1 4 5
B 3 3 5
A 5 6 1
6
4 1 2 5 6 3
4 6 1 3 5 2
B 3 ...

output:

ABBBAA
AABBAA
AAAAAA
AAABBA
BBBAAA
BBBABA
BBAABB
ABAAAA
AAABBB
BBBAAB
AAABBB
AAAAAB
BAABBB
ABBBBA
ABBBBB
BBAAAA
BBAAAA
BBAAAA
AABAAA
BBBAAB
BBBBBB
BBBBBB
BBBBBB
AAAAAA
BBBAAA
AABAAB
ABBBBB
BABBBB
BBBBBB
BBBBBB
BBABBB
BAABAA
BBAAAA
BBBAAA
AAAABB
BBBBBA
AAAAAA
BBBBAB
BBAAAA
AAAAAA
AAAAAB
BAAABA
AAAAAA...

result:

ok 83333 tokens

Test #19:

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

input:

71428
7
6 7 2 3 4 1 5
7 4 3 2 5 1 6
B 1 5 1
A 6 7 2
B 2 6 2
B 3 5 5
B 3 6 6
B 1 4 6
7
5 2 3 6 7 1 4
5 3 2 7 1 4 6
A 3 4 4
A 3 4 5
B 2 3 5
B 6 6 4
B 5 5 6
B 7 7 7
7
2 7 4 3 6 5 1
2 5 4 6 7 3 1
A 2 6 3
A 2 4 6
B 2 7 7
B 5 6 7
B 6 7 6
A 2 3 5
7
6 2 3 4 5 7 1
5 2 7 6 3 1 4
A 4 6 3
A 2 5 1
B 2 6 4
B 2 7 ...

output:

BBBBBBB
BBABBBB
AAABAAB
AABBAAA
ABBBAAB
AAAAAAA
BAAAABB
AAAAABB
AAAAAAA
AABBBBB
BAAABAA
BBBAAAA
AAABBAA
AAABBBB
AAABBBA
ABAAAAA
ABABBBB
BBAAAAA
AAAABBB
ABBABBB
AABAAAA
AAAABBB
ABABBAA
BBBBBBA
BBBBBBB
BBBBABB
BBBBBBB
BBBBBBB
BABBBBA
BBBBBBB
BBBBBBA
BBAAAAA
BBBBBAB
AAABBBB
AAAAAAA
ABBAAAB
BABAAAA
BBBB...

result:

ok 71428 tokens

Test #20:

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

input:

62500
8
4 8 5 3 2 1 7 6
8 2 1 5 7 3 6 4
A 2 7 7
B 4 6 6
A 1 7 6
B 1 8 6
A 3 8 7
B 4 6 8
B 1 4 3
8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AAAA
BBBBBBBBB
BAAAAAAAB
BBABAAAAA
AAAABBBBB
AAAAABAAA
AAAAABBAA
AABBBBBBB
ABBBAAABB
BBBAABBBB
BBBBAAAAA
...

result:

ok 55555 tokens

Test #22:

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

input:

50000
10
2 9 3 10 7 8 5 4 6 1
8 5 6 9 3 4 7 1 10 2
B 5 7 2
A 2 6 3
A 6 9 7
B 4 8 5
B 4 6 10
B 1 4 8
B 2 5 7
B 6 10 8
B 2 4 4
10
2 8 10 7 4 3 6 5 1 9
9 7 2 1 6 5 3 4 10 8
A 1 9 4
A 1 6 4
B 4 9 9
B 8 8 3
A 4 6 6
B 7 10 3
A 7 8 8
B 2 3 10
A 5 9 10
10
6 9 8 1 2 7 3 4 5 10
6 7 8 3 2 10 4 9 5 1
B 8 10 8
A...

output:

BBBAAAABBB
BBBAAABBBB
AABBBBBBAA
BBBBBBAABA
AAABBBAAAA
BBAAABBAAA
AABAAABABA
BBBBBAAAAA
ABBBAAAABB
BAAAAABBBB
AAAAAAAAAB
BBBBAAABAA
BBABBBBBAB
AABAAAAAAA
AAAAAAAABB
ABBBBBBBBA
AAAAAAAAAA
BAAAAAAABB
BBBBBBBABB
AABAAABBBB
BBBBBAAAAB
BBBBBBABBA
BBBBBAAAAB
BBAAAAABBB
ABAAAABBBB
AAABBBBBBB
BBBAAAAABB
BBB...

result:

ok 50000 tokens

Test #23:

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

input:

50000
10
5 6 7 10 9 3 1 4 8 2
6 7 8 1 10 4 2 5 9 3
A 2 4 10
A 4 6 7
B 4 10 1
B 1 10 4
B 6 7 2
B 6 9 4
A 4 5 2
B 1 4 8
B 2 4 10
10
3 6 2 1 4 5 8 10 7 9
2 5 1 10 3 4 7 9 6 8
A 2 10 2
B 3 6 3
A 5 6 9
A 4 6 5
B 5 7 7
A 2 4 2
A 2 10 9
A 2 3 8
A 1 4 6
10
7 10 3 5 6 8 2 1 9 4
6 9 2 4 5 7 1 10 8 3
B 5 7 7
B...

output:

AAAAAAAAAA
AABAAAAAAA
AAABBABBBA
AAAAAAAABB
AABBBAAAAA
ABAAAAAAAB
AABBAAABBB
AAABBBBBBB
ABAAAAAABB
AAABAAAAAB
AAABBAAAAB
AAAABAABBB
ABAAABBBBB
AABBBBBBBB
ABBAAAABBA
AABBBBBBBB
AAABBBABAA
AAAAAAABAA
ABBBBBBBAA
ABAAAAAAAA
AAAAABBABB
ABBBAABAAA
AAABBABBAA
AAABBBBAAB
ABABBBAAAB
AAAABBBAAA
AAAABBBBBB
AAA...

result:

ok 50000 tokens

Test #24:

score: 0
Accepted
time: 142ms
memory: 3628kb

input:

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

output:

ABAAAABBBBBBAABBBAAABBBAAAAAAABABBAAAAAAAAABBBBBBBBBBBBAAAABAAAAAABBABBABABBBBAAAAABBBBBBBAAAAAABBAA
AAAAAAAAAAABBBBBBBBBBABBBAABBBBBABAAAABBABBBBAABBBBBBBAAABBBBBBBBBBBBBBBAAAABBAAAAABBBBBBBBBBABBBBBB
BBBABBBBBBAAAAAABBBAABBAABBBAAAABBBBBBBABBBBBBBAAAAABBBAAAABBAABBBBBBBBABBBAABBBBBBBBBBBBBBBBBBBBA...

result:

ok 5000 tokens

Test #25:

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

input:

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

output:

AABBAABBBBBBBAAABBBBBBBAAAAAABBBBBAAAAAAAAAABAAABBAABAABBBAAAAAAAAAAABABBAAABBBAAABAAAAAAAABABBBABBB
AAAAABBAAAAABBAAAAAAAAAAABBBBBBAAABBBBBBABAABAABBABBABABBBBAABBBBBBAAAAABBBBBBBBBBBBAAAABBBBBAAABAAA
ABBBBBBAABBABBBAAAAAAABBBBABBBAABBBAABBBBBAAAAABABAAAABBAAABBBABBBBBBBBBBBBAAAAAAAABBABBAAAABAAAAA...

result:

ok 5000 tokens

Test #26:

score: 0
Accepted
time: 196ms
memory: 3904kb

input:

500
1000
848 318 934 571 327 838 490 937 18 608 517 439 245 363 645 585 341 410 427 447 616 250 855 463 708 142 525 510 10 24 100 871 542 628 752 298 464 647 617 480 287 435 349 856 783 981 720 367 443 178 826 361 391 903 773 788 915 63 230 133 440 397 511 453 632 144 858 507 155 512 347 429 199 382...

output:

AAAAAAAAABBBBBBBBBBBBBBABBBBBBABBBABAAAAAAAAAABBBBBBBBBBAAABBBBBBAAAAAAAAABABBBBBBBBBBBABBBBBBBAAAAAAAAAAAAAABBBBBBAAAAAABBBBBBBBBBBBAAABBBBBBBBBBAAAABAAAAABAABBAABBBBBBBAABBBBBABBBAAABABBBBAABBBABBBBBBAABBBBAAAAAAAAAAAAAAAAAAAABAAAABABBBBBBBBABBBBBBBBABAABBBBBBBBBBBBABBBABAAAAAAAABBBBBBBBBBBBBBBBBA...

result:

ok 500 tokens

Test #27:

score: 0
Accepted
time: 187ms
memory: 3900kb

input:

500
1000
932 433 836 39 281 722 285 616 860 195 760 531 605 331 908 8 126 713 680 491 726 12 343 391 578 522 43 4 251 469 892 86 363 392 830 303 669 596 861 703 441 364 257 623 791 618 158 727 68 737 707 573 921 138 348 500 169 716 928 187 378 802 115 880 362 614 692 736 887 11 428 200 972 347 185 1...

output:

AABBBAAAAAAAAAAAAAABBBBBABBBABAAAAABBBBBBABBBBBBAABABBBBBAABBAAAAABBBAAAAAAABBBBBAABBBBBBBBBBBBBBBBAAAAAAABBBBBBBBBBBAAAAAAAAAAABBBAABBBBBBBBBAAAAAAAABBAAAAABBBBBBABBBBABAAAAAABAAABBBABAAABBBBBBBAAAAABBBBAABBBAAAAAABAAAABBBBBBBBBBABAAAAAAAABBBBBBBAABAAAAAAAAAABAAAAAAAAAAAAABBAAAAAAAAAAAABBBBBBBBBAAA...

result:

ok 500 tokens

Test #28:

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

input:

50
10000
5770 1916 9365 4648 6825 1776 8277 8422 8362 2726 8769 4987 5714 8613 8672 165 6184 5815 4660 5695 4243 8086 925 837 1192 4378 8667 4327 8008 4212 478 6590 4768 7766 6558 5293 758 3009 3869 6836 3963 8266 3328 8433 1226 2880 750 1073 9946 8172 4665 9891 9063 5990 4280 1573 5615 3716 9053 64...

output:

BAAAAAAAAAAAAAAAABAAAABBABBBBAAABAAAAAAAAABBBAAABBBBBBBBBBBBBAAAAAAAAAABAAAAABBAABBABAAABBBBAAABABBBBBABBBBBBAAAAAABAAABBBBAAAABAABBBAAABBBBAAAAABABBBBBBBBBAABBBABBABAABBAAAAAAAAAAABBBBBABBAAABBBAAAABBBBBBBBAAAAAAABBBBBBBBAAAAABBABBBBAABBBBBAABBBBBBBBAAAAAABAAABBBBBBBBBBBBBBAABAABBAAAABBBBBAAABAAAAA...

result:

ok 50 tokens

Test #29:

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

input:

50
10000
3841 5271 3559 6257 3015 9082 9598 1294 9148 2584 5723 7740 930 1793 8405 111 1536 7462 1917 8349 6483 6605 856 8718 2073 4628 8271 5146 4822 7491 973 9276 8970 5462 5069 1888 6536 5175 9000 2216 3838 500 4930 5305 5731 7807 3804 4385 772 2381 6610 8774 1719 3335 3541 4582 269 7978 5463 823...

output:

AAAABBBBBBBBAAAABBBBAABBBBBABAAAAAAAABBBBBBBBBBAAAABBAAAAAAAAAAAAAAABAAAAAAABBAAAABBABBBBBBBAAAABBAABAAABBAAAAAAAABAABBBBBABBBBBBBBBBAAAAAAAABAAAAABABBBBBAABBBAAAAABBBBBBBAAABBABBABAABBBBAAABAAABBBBAAABBBBBBBAAABAAABABBBBAAABBBAAAAABBBAABBBBBBBAABAAAAAABAAABBAAAAAAAAABBAAAAABBBBBBBAAAABAAAABBBBAABAA...

result:

ok 50 tokens

Test #30:

score: 0
Accepted
time: 271ms
memory: 5344kb

input:

5
100000
38957 93866 63942 98643 72376 14908 17770 5150 85915 90526 22231 80776 53260 31859 70065 19986 70534 98838 45026 16059 11953 10324 906 46368 20030 80074 62169 81672 57995 17934 82692 18538 8820 95487 85388 38698 23018 90175 97023 28600 15826 20801 90556 80920 89207 93035 5841 30996 54580 57...

output:

AAAAAAAABBAABAABAABBABBBBBAAAAABBBBAAABBBAAAABBBBBAABBBBBBBBBBBBBBBBBBAABBBABBBAAABBBBABBBBAAAAABBBAAAAAAAAAAAABBABBBBABBBBBBBBBAAAAAAAAABABBBBBBBAAAAABBABABBBBABBAAABBBAAAAAABBBAAAAAAAAAAAAAABBBBBABBBABBBAAAAAAABABBBBABAAABBBBAAAAABBBBBBBBBAAABBBBABBBBBBBBBBBBBBBBBAABBAAAABBBBBAABABBBAAAAAABBBBBBBB...

result:

ok 5 tokens

Test #31:

score: 0
Accepted
time: 273ms
memory: 5656kb

input:

5
100000
32145 13004 24910 45857 91071 88956 61560 11562 95433 33315 82834 8953 66459 63865 33968 7755 18194 4684 47596 96973 48448 57046 32757 67587 5379 90899 13982 81534 51100 28860 76105 16072 57989 3079 77840 54708 66148 65696 96791 53194 72048 5214 6867 41179 31685 84980 17652 3824 82249 5208 ...

output:

ABBAABBAABAAAABABBBBBBBBBBBBBBBBBBBAAAAAABAAABBAAAAABBBBBBBAAAAAAABBBBBBAAAAAAAAAAABBABBBBBABBAAAAABAABBAAAABBBBBAAABBBBBBBAAABBBAAABAAABBBBBBABBBBABBAAAAABBBBBAAABBBBBABBBBAAABAABBBBAAAAABAAAABBAAAABBBBBBAABBBAAAAAAAAAAABBABBBBBBBBBBBBBBAABBBAAAAABBBBBBBBBBABBAABBBBBAAAAAAAAAAAABBAAAAAAAAAABBBBBBBA...

result:

ok 5 tokens

Test #32:

score: 0
Accepted
time: 357ms
memory: 11212kb

input:

1
500000
22065 419171 323138 424150 81831 149873 325669 219412 484459 64726 175246 224111 76922 302169 454050 104360 8994 478332 7597 310888 211518 78451 209632 375121 276156 263018 330256 369578 28178 378410 352789 103107 354 57551 380506 356202 254301 121187 472590 383435 138699 448725 9267 399880...

output:

AAAABABBBBBBBAAAAAAAAAAABBBBBAAAABBBBBBBBAABBABAAAAAAABBBBABAABBABAAAABBBBBBBBBAAAAAAAABAAAABBBBABBAAABBAAAAAABBBBBABAAAABBBBBBBBBAAAAABBABBAAAAAAAAABBAAAAAAAABBBAAAAAAAAAAAAAAABBAAAAAAAAAAAABABBBABBBABBBBBBAAAAAAAAAAABBBBBABBBBBAAAAABAAAAAAAAAAABBAAABBBABBAABBBBBBBBBAAAAABBBBBBBBABAAABBABBBBBBBBBAA...

result:

ok "AAAABABBBBBBBAAAAAAAAAAABBBBBA...BAAABBBBBABBAAAAAABBAAABBBBBAAA"

Test #33:

score: 0
Accepted
time: 345ms
memory: 11268kb

input:

1
500000
241878 375551 206433 118329 388200 156556 73638 192543 261664 51115 97790 347249 489238 361894 50908 299684 322481 119127 104642 336109 362260 362628 58106 395583 413353 95442 127873 140536 445615 352214 56039 498644 409217 424202 142886 338315 82868 29177 112590 443553 27819 158811 141190 ...

output:

AAAAAAAABBAABBABBBBAAAAAABBBAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAABBBBBBBABBBBBBAAAAABAAAABBBBBAAAAAABAABBBBBBBBBBBBBBAAAAAAABAAAAAAAABBBAAAAAAABBBBBBBBBBBBBBABBBBAAAAAAAAAAAAAAAABBBBAAAAAAAAABBBBBBBBBAAAAAAAAAAAAAABBBBBBBAAAAABBBBBBABAAAAAAAAAAAAAABBBBBBAAABAABBAAABBBAAAAABBBBBABBBBBBBBBBBBBBABBAB...

result:

ok "AAAAAAAABBAABBABBBBAAAAAABBBAA...BAABAAABABBAAABBBBBBBBBBBABBAAB"

Test #34:

score: 0
Accepted
time: 356ms
memory: 11180kb

input:

1
500000
189758 31010 211346 333942 24086 342517 213185 82824 90568 426561 28162 238697 191848 250990 226653 290232 486713 271116 180209 186207 381468 327653 451526 436582 106067 134017 190838 399456 296304 115160 407335 54647 151399 114060 330249 483088 106708 297908 481692 157840 219691 106578 487...

output:

BBBBBBBBBABBAAAAAAAABBBBBBBBAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAABAAAAABBABBBBAABABBBBAAAAAAABBBBBBBBAAAABBBAAAAAABBBBAAAAAAABBBAAAAAAAABBBBBAAAAABAABBABAAAAAAABBBBBBABBBAAAAAAAAAAAAABBAABAAAAABBBAAABBBBBBBBBABBAAAAAAABAAAAAAAAABBAABBAABAABAAAAAAAAAAAAAABBAAAAABBBBBBBBABAAAAAAAAAAAABBBBBAA...

result:

ok "BBBBBBBBBABBAAAAAAAABBBBBBBBAA...BBAAAABBBBBAAAABABBBABBBBBBABAA"

Test #35:

score: 0
Accepted
time: 353ms
memory: 11164kb

input:

1
500000
365150 222032 343017 270834 411921 78406 293950 30003 443802 444738 283901 316023 430832 102961 235295 314189 260108 5383 281944 51654 173587 142417 273047 211832 450786 147019 191054 91665 369074 476531 304741 246259 383603 476923 471150 358078 204009 288949 443046 293018 39011 55275 28465...

output:

AABBBBAABAABBBBBBBBBBBAAAAAAABABBBBBBBAAAABBAAAABBBBBAAAAAAAAABBBBBBBBAAAAAABAAAAAABBAAAABBBBBBBBABBABAAAAABBBBBBAABBBBAAAAAAABABAAAAAAABBBBBBBBBBAABBBBBBBABBBAAABBBBBAABAABBBBBBBBBAAAAAAAABBBBBBBBAAAABBABAAABBBBBBAAAAAAABBBBBBABBBAAAABBBBBBBBBBBBAAABAAAAABBBABAAAAAAABABBBBBBABAAAABBAAAAAABBBAABBBBB...

result:

ok "AABBBBAABAABBBBBBBBBBBAAAAAAAB...AAAAAAABBABBBBBBBAAAAAAABBAAAAA"

Test #36:

score: 0
Accepted
time: 362ms
memory: 11224kb

input:

1
500000
248962 259171 261011 68409 102255 299613 295471 60404 478187 419895 109919 68912 179925 481390 364289 64910 350835 380243 497714 427615 472085 380419 42629 147913 196333 202451 101588 445671 444096 415934 360071 233383 353726 31547 128441 183091 334008 408872 56954 202572 389952 184320 1483...

output:

BBBBBAAAABBBBAAABBABBAAAABBAAAABBBAAAAAABBBBAAAAAAAAAAABBBBBBBBABBBBAABBBBBBBBBAAABBAAAAAAABBBBAAABBBBBBAAAAABBBBBBBBBBBBBBBAAAAAAABBAAAAAAAAAAABBAAAABABBBBABAAAABABBBBAABBAAABBBBBBAAABBBBBAAABBBBBBAAABBABBAAAABBBBABABBBBBAAAAAAAABBBBAAABBBAAAAAAAAAAAAAAAAAAAAAABBBAABBAAAAAAAAAAABBBBABBBAAAAAAAAAAAB...

result:

ok "BBBBBAAAABBBBAAABBABBAAAABBAAA...BBAAAAABBBBBBABBBAAAABAAAAAAABB"

Test #37:

score: 0
Accepted
time: 358ms
memory: 11336kb

input:

1
500000
12621 177040 162839 268632 251379 129839 493017 192851 313039 468201 429728 287087 138486 403561 433423 268683 297071 365240 30179 230544 80564 146698 151378 496045 89956 153604 267185 446790 277526 285056 421478 494337 33234 238743 380608 137437 139323 100671 276424 327259 217316 295836 20...

output:

AAABBBABBBBAAAAABBBBAAAAAABBBBBBBBABBAAAABBBBABAAABBBBABBABBAABAAAAAAAAAAAAABBBBBBAAABAAAABBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAABAAAAAABBBBAAABAAAAAAAABAAAAABBABBBBBBBBBBAAAAAAAABBAAAAAAAAAABBAAABBBBBABABAAAAAAAAAAABBAAAABBBABBAAAAAAAAABBABBAAAAABBBBBAABABABBBABAABBBBBBAAABBBBBAAAAAAAABABBBAAABBBAABBBBBBB...

result:

ok "AAABBBABBBBAAAAABBBBAAAAAABBBB...BBABBABBBBBBBBAAAAABBBBBBBAAABB"

Test #38:

score: 0
Accepted
time: 354ms
memory: 11272kb

input:

1
500000
207961 142481 326674 383900 387229 66868 130480 459220 359664 475043 380128 289715 327440 324650 133894 154034 56929 229503 499482 254161 384561 136942 394924 420681 105718 106546 455647 263609 165705 121168 242942 224964 390419 48819 492546 103548 167242 443972 270412 160596 318734 487244 ...

output:

BBAAAABBBBAABABBBBBBBBBBAABAAABBBBBAABBBBBAAAAABAABAABBBBBBBBBBBAAABAAAABBBBBBABBBABBBBAAAAAAABBBBBAABBBBAAABBBBABBBBAABBBBBBAAAAAABAAAAAAABBABBAAAAABBBBAAAAABAAAABAABBBBBBBBBBAABBBAAABBABBBBBAAAABBBBAAAAAAAAAAAABAAAAAABBBBBBBBBBBAAAAAABABBAAAAAABAAAABBBABBBBAAAABBBBBBBAAAAABBBABBBBBBAAAABAAAAAABBBA...

result:

ok "BBAAAABBBBAABABBBBBBBBBBAABAAA...ABBBBBBBAAABBBBBAAAAAAAABABBBBB"

Test #39:

score: 0
Accepted
time: 351ms
memory: 11244kb

input:

1
500000
29729 203859 32152 286575 367117 403792 286799 183535 271036 141373 285890 487683 91002 169893 23753 326815 209229 305404 389019 57208 343191 187525 50621 50821 429775 322681 376881 109865 241513 494648 229548 483634 461276 368925 463416 457453 315345 257190 202746 326171 376579 251401 4913...

output:

AAABAAABBBBBAAAABBABBBBBBAAABBAAAAABAAAAAABBBABAAAAABBBBAABBBBAAAAAAAABBBAAAAAAAAABBBBABBBBAAAAAAAAAAAAAAAAABBBBBABAAAAAAAAAAAAAAAAAAABBBBAAAAABAAAAAAAAAAABBBBAAABBBBBBBBABBBBBBBBBBABABBBAAAAAAAAAABBBAABAAAAAAAAAAAAABAAAAAABBAAAAAAABAAAAABAAABBBBAAABBAAAAABBBAABBBBBBBBAAAAAAAABAAAABBAAAAAABBBBBBBABB...

result:

ok "AAABAAABBBBBAAAABBABBBBBBAAABB...BBBAAAAAAAAAAAABBAAAAABBBAABBBA"

Test #40:

score: 0
Accepted
time: 348ms
memory: 11272kb

input:

1
500000
126593 310053 31741 342204 139778 150213 441424 424109 27606 80544 45034 420484 67960 381116 248788 258060 114674 436454 82978 67848 260031 424762 38830 16539 95164 162798 348056 250230 147025 321127 281572 263194 334612 466090 362478 218504 105365 450888 250429 22606 251121 340491 175624 1...

output:

AABBBBBBBAABBBAABABBBBBBBBABAAAAAAAAABBBBBBBBABBBABBBBAABBBAAAAAAAAAAAAABBBBBBAAAABBBAAABBAAAABBAAAAABBBAAAABBBAAABBBBBBBBAABABBBBBBAABABBBBAABBAAABBBBBBBBBAAAAAAABAAAAAAAAABAABBAABBBBBAAABBBBBBBBBBAAABBAABBBBBBBBBBBBBABBBBBBBBBBBBBAABAAAAAAAAABBBBBBAAABBBAAAAAAABBAAAABBBBBAAABBBBAAAAAABBBABAAAAAAAA...

result:

ok "AABBBBBBBAABBBAABABBBBBBBBABAA...BBABBBBAAAAAAAABBBBBBABBBAAAAAA"

Test #41:

score: 0
Accepted
time: 359ms
memory: 11192kb

input:

1
500000
434421 69114 401590 240668 61670 86544 214710 192699 442599 193043 364774 433135 124025 132349 499801 31542 333384 444287 207324 400266 434205 264391 139816 422675 496844 465368 134098 191280 280397 60839 258802 304562 149493 116242 487244 302921 410532 22958 423886 477736 423418 146850 303...

output:

AAAAABBAABAAABAAAAAAAAABBBABABBBBBAAAAAAABBBBBBBBBBBBBAABBBBBBBBAAAAAABBBBBBBBBBBAAAAABBBBBBBBBBBBBAABAAAABBAAAAAAAAAAAAAAAAAAAAAAABBAAABBBBBBBBBABBBBAAABAAAAAAAAAAAAAAAABABBBBBAAABBBAAABBBBBBAAAAAABBBBBBAAAAAABBBBBBBBBBBBBBBBBBBBBBAAAAAAABBBBBBBBAABBBBAABBBBBBBBABBBBBBBBAAAAABAAAAAAAAABBAAABAAAAAAA...

result:

ok "AAAAABBAABAAABAAAAAAAAABBBABAB...BAAABBBBAABBBBBBAAABBABAAAAAAAB"

Test #42:

score: 0
Accepted
time: 357ms
memory: 11144kb

input:

1
500000
112380 315628 322266 139793 261421 83993 83263 418467 231710 254749 207591 27942 399529 314445 489847 104847 218959 341554 340943 437639 365905 130819 443123 278352 285776 284996 11550 123744 155421 407079 121651 43122 171677 280667 212559 309058 45697 246637 209907 497627 286332 316339 533...

output:

AABBBABBAAABBBAAABBBBBAAABAAAABBBBBBBBBBBBBBBAABBBBBBBBBBBABAAAAAAAAAABBAAAABBBBBAAABAAAABBBAAAAAAAABAAAABAAABBBABAAAABBAAAAAAAABBABBABAAAAABBBBBBAAAAAABAAAABBBAABBBBBBBBBBBAABBBAAABBAAAAABBBABBBBBBBBBBBBBAABBBBBBAAABABABBBBAAAAAAAAAAAAAABBABBAAABBBBBBBBBBBBAAABBBBAAAABBBBBBBBBAAABBBBBBBBBAAABBBBAAA...

result:

ok "AABBBABBAAABBBAAABBBBBAAABAAAA...ABABAAAAAAAAAAAABBBABBBABBBBBBA"

Test #43:

score: 0
Accepted
time: 354ms
memory: 11228kb

input:

1
500000
456497 389842 7668 42849 326624 222619 149837 443793 110149 94346 386364 372060 56817 20057 293222 212432 55791 158521 241279 339013 491772 50964 54077 481078 102991 135240 167059 313866 295570 395806 65960 74680 386909 271784 265453 296776 393022 368339 32026 468333 56641 154618 409644 108...

output:

BBBBBBBBBBBAAABBBAAAAAAAAAAABBBBAAABBBBAAABABAAAAAAABBBAAABAAABBBAABBBBBBBBBBBABBBBAAAAABBAAAABBBAAAAABAAAAAAABBAAABBABAAABBABBAAAABBBBAAAAAAAAABBBBBBBBBBAAAAAAAAAABBBBAABBBBBBBBBBBBBAABBBBBBBBBAABBAAABBAAAAAAAABBBAAABBBBABBBBBBAABBBBBBAAABABBBBBAAAAABBABBBBAAAAAABAABAAAAAABBBAAABBAABBBBBBBBAAAAAABB...

result:

ok "BBBBBBBBBBBAAABBBAAAAAAAAAAABB...BBBBBAAAAAAAAAABABBBAAAAABABBAB"

Test #44:

score: 0
Accepted
time: 345ms
memory: 11208kb

input:

1
500000
158422 42590 199912 178522 403562 214564 216998 323752 459132 40727 61999 76287 204189 474865 323145 204257 666 130843 19063 6777 342355 362208 256043 103229 457020 455165 282247 280161 485977 469436 68726 248221 420081 345535 34492 496417 403457 60312 276580 338449 457978 484376 488030 230...

output:

AAABBBBBAABBBBBBBBBBBBBBBBBAAAABBAABBAAAAAAABAAABAAAAAABBBBBBBBBBBBBBBBBBBAABBBBAAAAAAAAAABBBBAABBABBABBAAAABBBBAAABBBAAABBBABABBBBBAAAAABBABBBBABBBBAAABBBAAABBBBBBAABBBBABBBBBAAAAAABBBBBAAAABBBBBBBAAABBBBBAAAAAABAAAAAABBBBBAABBBBBBAAAAAABBBBBABABABBAAAAAAAABBBBBBBBBBBBABBAAAAAAAAAAABBBBBBAAAAAAABBB...

result:

ok "AAABBBBBAABBBBBBBBBBBBBBBBBAAA...ABAAABBBBAAAAABBBBBABBBBABBBBBB"

Test #45:

score: 0
Accepted
time: 353ms
memory: 11204kb

input:

1
500000
357956 4142 109179 338573 107106 20781 263392 421116 432868 452896 360584 94284 100116 333419 295024 439595 338679 140727 449327 254281 379485 99848 180980 296850 471725 153449 110599 268404 142236 148819 199399 158423 52321 70610 151522 243732 368103 299779 486832 32003 215454 462886 44143...

output:

AABBBBBAABBAABBBABBBBBAAAAAAAAAAAABBBBBABAABABAABBBBBAAAABBBBBBBBAABBBABBAABBAAAAAAAAAABBBBAAAABBABBBBBAABABBBBAAABBBAAABBABBBBBAAAABBBBBBBAABBBBBBBBAAABBAAAAAAAAAABBBBBBAAAAAAAABBBBBBBBBAAAAAAAAAAAAABBBBBBBAAAAAABAABBBAABBBBBBABBBBAAAAABABBBBBAAAAAAAAAAABBAAABABAAABBBABAAAAAABABBBBBBBAAAAAABBBBBBBB...

result:

ok "AABBBBBAABBAABBBABBBBBAAAAAAAA...BBBBBABBBBAABAAAAAAAAAAAAAAAAAA"

Test #46:

score: 0
Accepted
time: 354ms
memory: 11192kb

input:

1
500000
33210 465158 411375 158260 483300 380874 334789 414708 236861 375663 46898 124363 217343 320420 497965 460134 100403 358548 214915 391957 26000 411514 455624 308786 446544 341419 83208 228059 312269 358281 301152 111501 160878 53552 205366 430509 134623 148751 115165 357873 169987 352001 12...

output:

BAABBBBAABAAAAAAAAAABBBBBBBBBAAABAABAAAABBBBBBBAAAABBBBBBBBAAAABBBBABBBAAAAAABBBAAAAABBBAAABBBBBBABBBBBBBBAAABBAAABBBBBABAAAAAAABBBBABBBBBBBBBBBBAAABAABBBBBBBBBBBBBBAABBBBBBAAABBBBBBBBBBBBAABBBAABBBBBBBBBBABBAAAAAABAAAAAAAABBBBBAAAAAAAAABBABBBAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBABBAAAAAAAAABBBB...

result:

ok "BAABBBBAABAAAAAAAAAABBBBBBBBBA...BBBAAAAAAABBBBBBBBBBBBABBBAAAAA"

Test #47:

score: 0
Accepted
time: 358ms
memory: 11180kb

input:

1
500000
76884 391214 311855 138054 366479 415710 201498 237761 18582 13187 447587 324835 224636 381508 68757 435356 253717 429598 20480 109935 120523 371168 349943 33287 277992 337786 412446 123454 351932 219661 458587 316572 288071 126775 14016 284997 437028 96305 319813 441922 43686 96824 68343 8...

output:

ABAAAAABBBAAABAAAAAABBAABBBBBABBBBBBAAAAAAAAAABBBBABBBBBBABBBBBAAABBBBABBBBAAABAAAABAABBBABBBBBBBBBAABBBBAAAABBBAABBBBBBBABBAAAAAAAAAAABAABBBAABBAAAAABBAAAAAABBBBBAAABABAAABBBAAAAAAAAAABBBBBBBBBBBBBBBBAABBBBBAAAABBAAAAABBAABBBAAAAAAAAABBAAAAAAAAABBBBBAAABAABBAABBBAAAABBAAABAAAAAAAAAAABBAAAAAAAAAAAAB...

result:

ok "ABAAAAABBBAAABAAAAAABBAABBBBBA...BBBBBBBAABBBBBBAAAAAAABBBBBBBBB"

Test #48:

score: 0
Accepted
time: 360ms
memory: 11316kb

input:

1
500000
88635 68859 495318 384171 320604 95127 243361 131975 241154 78797 124670 107875 123894 213534 27321 310883 436644 217759 314300 139689 172671 189301 226186 65923 493072 210208 236367 319845 253732 139413 495413 64371 346874 129917 83133 57550 9339 139760 115719 163107 423290 434223 360003 1...

output:

BBBBBBBBBAAAABBBBBBBBBBAAAAAAAABBABBBAAABAAAAAAAAAAABBAAAAABBBBBABABAABBBBAAAABBBAAAABBAABBBBBBBBAAABBBBBBBAAAAAABAABBAAABBBBBABBABAAABBBABBBBBBBAAABABAABBBBAAABBBBBBBBBAAAAAAABAAABBBAAAAAAAABBABBBBBBAABAABBBBBBBBBABBBBAAAABBBBBBBBBBBBBBAABBBBBAAABAAAAAAAAABAAAAAAAABBBBBAAAAAAABBBBBBBBBABBBBBABAAABA...

result:

ok "BBBBBBBBBAAAABBBBBBBBBBAAAAAAA...AAAABBBABBBABBAAABBBBBBAAABBBAB"

Test #49:

score: 0
Accepted
time: 356ms
memory: 11264kb

input:

1
500000
34498 42215 333851 443867 403494 218805 356124 384785 423625 51225 51046 450706 279335 271242 83385 48614 369470 371867 1000 5932 470326 59940 67862 38690 64456 36969 107442 268726 346043 340901 338610 170375 216495 492203 323632 134489 492302 129727 415963 344510 84114 287782 11764 137896 ...

output:

AAABBAAABABBBABBBBBBBBBBBBBBAAAAAAAABBAAAAAAAAAAAAAAAAAAAABBBAAAAABBBBAAAAAAAAABBBAAAAAABAAABABBBBBBBBBBAAAAAAABBBBBBAABAAABAAABBBBBBABAAABAABBBAAAABBBBBBBBBBBBBBAAAABAAAABBAABBBBAABBBBBBBBBBAABAABBBBBBBBBAABBBBBBBBBBBBABBBAABAAAAAAAAAAAAAABBABBBBAABBBABAAAAABBBBAAAABAAAABBABBABBAAAAAABBBBBBBBAAAAAA...

result:

ok "AAABBAAABABBBABBBBBBBBBBBBBBAA...BBAAABAABAABBBBBBBBAAAAABBAABBB"

Test #50:

score: 0
Accepted
time: 353ms
memory: 11184kb

input:

1
500000
66336 329884 70383 43615 117372 81725 129383 100230 377770 321301 172531 146971 399541 2204 216524 23119 221529 388030 211377 140301 227362 373571 92977 326856 38523 457332 180756 484630 267982 45598 49501 398941 209644 259098 234301 204864 262422 83143 394999 120660 233890 70330 82793 1969...

output:

ABBBAAAABBAABAAABBBBBBBBBBBBABBAABBAAAABBBBAAAABBBAAAAAAAAAAAAAAAAAAAABABAABBAABBAAAAABBBAABBBBAAAAABBABBBBBBBBBBBBBBAABBABBBBABBAAAAABAABBBBBABBABAAAAAAAAAAABBBBBBBBBAAABAAAABBABBBBBBAABBBBBBBBBBBBBBBBBBABBBBAABBAAAAAAAABAAAABBBAAABBBBBBAAAABBAAAAABBBBABBBBBBABBBBBBAAAAAAAAABBAAABBABBAABBBAAAABAAAA...

result:

ok "ABBBAAAABBAABAAABBBBBBBBBBBBAB...BBBBBBBBBBBBBBBBAAAAAAAAABAABBB"

Test #51:

score: 0
Accepted
time: 358ms
memory: 11224kb

input:

1
500000
475765 118493 134635 252438 85583 141175 182953 460653 49220 202524 219447 239172 232258 332947 313463 41132 112941 7343 213912 130977 227737 161631 441505 428325 277871 77682 14707 259427 56262 129925 458378 20349 286561 187817 231440 131210 113095 201627 461287 310804 295957 245702 286957...

output:

AAABBBBAAAAAAAAAAAAABBBBAABBBBAABBBBBBBBAAAAAAAAABBBBBBBBAABBBBAAAABABBBBAABBBBBBBBBAAAAAAAAABAABAAAAABAABBABAAABBBBBBAAAAABBBBBBAAAAAAABAAAABBBABBBBBBBAAAAAAAABBAAAAAAABABAAABBAAAAABAABBBBBBAAAAABBAAAABBBAAAABBBAAAABAAAAABAABBBBBBABBAAAAAABBBBBBBAABBBBAAAAAABBBAAAABBBBBBBBBAAAAAAABBBAAAAAAAAAABBBAA...

result:

ok "AAABBBBAAAAAAAAAAAAABBBBAABBBB...BAAAABBAABBAAAAABBBBBBBBBBBAAAA"

Test #52:

score: 0
Accepted
time: 371ms
memory: 11172kb

input:

1
500000
78560 357866 189998 361316 97304 162781 259195 414602 411615 353069 105893 401191 85152 310000 327855 389418 492362 259874 456962 70238 206695 156198 390297 421305 278617 169896 231123 139195 349447 449594 185551 407958 8514 217378 254471 201240 228221 86128 355740 93138 364161 134341 61736...

output:

ABAAAABBBBBAAAAABBBBAAABAAAAAAABBBBBBBBBBABBABAAABAAAAABBBAAABBBBAABBBBAAABAABBBBBBBBBABAAAAAAAAAABBABBBBBBABAAABABAABABAAABBBBBBABBAAAAAAAAABABBBBABBAABBABBBBBBBBBBBAAABBBBAAABBBBBAAABBBABABBBBBBBBBBBBBAAAAAAABBABBBBBBABBBBBBAAAABAAAAABAABBAABBBBAAAAAAABBBBBAAABAAAABAABAABBBAAAAAABABBBAAABBAAAAAAAB...

result:

ok "ABAAAABBBBBAAAAABBBBAAABAAAAAA...BAAABAABBBBBABBABAAABBBBBBBBBBB"

Test #53:

score: 0
Accepted
time: 354ms
memory: 11188kb

input:

1
500000
333976 489006 351478 181969 53656 195488 496986 374912 402054 198875 240459 229425 442231 368155 176089 224304 375466 415734 418531 41782 395452 118866 435097 267384 245 40049 83120 408389 340376 333811 408835 207657 296245 202790 307018 415339 67497 353078 246569 286465 405322 427535 31978...

output:

AAABAAAAABBABBAABABBBBBBBBBAAABABAABBBAAAAABBAABAAAAAAAABAAAABAABBBBBBBBBBBBBBAAAAABBBBBBBBABBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAABAAAAAABBBAAABBBBBBAAAAAAAAAAAAAAAAAAAABBBBBBBBAAABBAAAAAABBABAAAAAAABAAAABBBABBAAAABBBBBBAAAAAABBAAAAAAAAABBBBBBBBBBBBBBAABAABBBBBBABBBBAAAAABAAAABAAAABBBABAABBBBBBBBBBBBBAABB...

result:

ok "AAABAAAAABBABBAABABBBBBBBBBAAA...BBBBBABAAAAAAAAAAAAAAAAAAAAAAAB"

Extra Test:

score: 0
Extra Test Passed