Codeforces 875div2 B
// compile: make data
// run: ./data < data.in
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#ifdef LOCAL
#include <debug/codeforces.h>
#define debug(x...) _debug_print(#x, x);
#else
#define debug(x...) {};
#endif
template<typename...Args> void print_(Args...args){((cout<<args<<" "),...)<<endl;}
#define rep(i,a,b) for(int i=(a);i<(int)(b);++i)
#define sz(v) ((int)(v).size())
#define print(...) print_(__VA_ARGS__);
#define INTMAX (int)(9223372036854775807)
#define INF (int)(1152921504606846976)
#define double long double
#define int long long
#define MAXN 200010

void solve() {
    int n; cin >> n;
    vector<int> a(2*n+1), b(2*n+1);
    int pre = 0, num = 0;
    rep(i, 0, n) {
        int x; cin >> x;
        if (x != pre) a[pre] = max(a[pre], num), pre = x, num = 1;
        else ++num;
    }
    a[pre] = max(a[pre], num);
    pre = 0, num = 0;
    rep(i, 0, n) {
        int x; cin >> x;
        if (x != pre) b[pre] = max(b[pre], num), pre = x, num = 1;
        else ++num;
    }
    b[pre] = max(b[pre], num);
    int ans = 0;
    rep(i, 0, 2*n+1) {
        ans = max(ans, a[i] + b[i]);
    }
    cout << ans << endl;
}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int _; cin >> _;
    while (_--) solve();

    return 0;
}

Comments

  1. 1 month ago
    2026-8-13 22:24:53

    I switched platforms last month and the difference in performance is night and day. Withdrawals land in my e wallet before I finish my morning coffee. The interface is clean and the promotions actually fit realistic budgets. idprada188

  2. 1 month ago
    2026-8-13 22:25:12

    I switched over to 9bdapp after getting frustrated with slow payout times on other platforms and the difference is night and day. My winnings land in my account within hours and the app never crashes during live sessions. The game providers are all licensed and fair which gives me real peace of mind. Definitely recommend it to fellow players looking for consistency. 9bdapp

  3. 1 month ago
    2026-8-13 22:25:29

    The welcome bonus here is actually what they promise and not some hidden catch. I enjoy the variety of sports markets and the payment options are super convenient for Thai users. Keep up the great work. thlucabet168

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
Previous
Next