QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#614055#4789. Infinite Pattern Matchingucup-team4153#AC ✓1ms3840kbC++203.3kb2024-10-05 15:30:092024-10-05 15:30:11

Judging History

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

  • [2024-10-05 15:30:11]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3840kb
  • [2024-10-05 15:30:09]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
ll rk[67];

bool check(string s, ll x) {
    if (x <= 0)return false;
    ll n = x;
    vector<int> bit;
    while (n) {
        bit.push_back(n % 2);
        n /= 2;
    }
    for (int i = 0; i < bit.size(); i++) {
        if (s.empty())return true;
        if (s.back() - '0' != bit[i])return false;
        s.pop_back();
    }
    return check(s, x - 1);
}

bool check2(string s, ll x) {
    ll n = x;
    vector<int> bit;
    while (n) {
        bit.push_back(n % 2);
        n /= 2;
    }
    reverse(bit.begin(), bit.end());
    for (int i = 0; i < bit.size(); i++) {
        if (i >= s.size())return true;
        if (s[i] - '0' != bit[i])return false;
    }
    return check2(s.substr(bit.size()), x + 1);
}

ll get(ll x) {
    for (int i = 56; i >= 0; i--) {
        if (x >> i & 1) {
            return rk[i] + (x - (1ll << (i)) + 1) * (i + 1);
        }
    }
    return 0;
}

ll get(string s) {
    if (s.size() > 56)return 8.2e18;
    ll x = 0;
    for (auto v: s)x = x * 2 + (v - '0');
    return get(x);
}

ll now;

ll cal(string pre, string suf) {
    int n = pre.size(), m = suf.size();
    int len = 0;
    for (int i = 1; i <= min(n, m); i++) {
        if (pre.substr(0, i) == suf.substr(m - i))len = i;
    }
    string res = suf + pre.substr(len);
    if (res.size() <= 56) {
        now = 0;
        for (auto v: res)now = now * 2 + v - '0';
        now--;
    }
    return get(res) - (n - len);
}

void brute() {
//    string ans;
    for (int i = 1; i <= 15; i++) {
        vector<int> bit;
        int x = i;
        while (x) {
            bit.push_back(x % 2);
            x /= 2;
        }
        for (int j = (int) bit.size() - 1; j >= 0; j--)cout << bit[j];
    }
    cout << "\n";
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    for (int i = 1; i <= 56; i++)
        rk[i] = rk[i - 1] + (1ll << (i - 1)) * i;
    string s;
    cin >> s;
    if (s == "01") {
        cout << "4\n";
        return 0;
    }
    ll ans = get("1" + s);
    int n = s.size();
    for (int i = 0; i < n; i++) {
        ll x = 0;
        if (s[i] == '0')continue;
        for (int j = i; j < n; j++) {
            x = x * 2 + (s[j] - '0');
            if (check(s.substr(0, j + 1), x) && check2(s.substr(i), x)) {
                ans = min(ans, get(s.substr(i, j - i + 1)) + n - j - 1);
            }
        }
    }
    for (int i = 1; i < n; i++) {
        if (s[i] == '0')continue;
        string pre = s.substr(0, i);
        string suf = s.substr(i);
        int p = -1;
        for (int i = pre.size() - 1; i >= 0; i--) {
            if (pre[i] == '0') {
                p = i;
                break;
            }
        }
        if (p != -1) {
            pre[p] = '1';
            for (int j = p + 1; j < pre.size(); j++)pre[j] = '0';
            ll res = cal(pre, suf);
            now >>= i;
            if (s[0] == '0' && !now)continue;
            ans = min(ans, res);
            continue;
        }
        pre = string(pre.size(), '0');
        pre[0] = '1';
        while (pre.size() <= 56) {
            pre.push_back('0');
            ll res = cal(pre, suf);
            ans = min(ans, res);
        }
    }
    cout << ans << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11

output:

2

result:

ok answer is '2'

Test #2:

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

input:

011011

output:

42

result:

ok answer is '42'

Test #3:

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

input:

01000110011010110000

output:

4627720

result:

ok answer is '4627720'

Test #4:

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

input:

1011000001101110110111001010001010010101010000101

output:

1617827598069187

result:

ok answer is '1617827598069187'

Test #5:

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

input:

101100110110001000010000010111010

output:

4284278055

result:

ok answer is '4284278055'

Test #6:

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

input:

10000111000100011000010101001101001010011111010100000

output:

233619077992339454

result:

ok answer is '233619077992339454'

Test #7:

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

input:

0101110001000010010101001000

output:

1743694743

result:

ok answer is '1743694743'

Test #8:

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

input:

0000010010000011000110000111101011010111101100

output:

376257416587436

result:

ok answer is '376257416587436'

Test #9:

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

input:

0000001001011101111001

output:

42369600

result:

ok answer is '42369600'

Test #10:

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

input:

0011110101101111101000111110111100000000000011

output:

87982575481536

result:

ok answer is '87982575481536'

Test #11:

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

input:

10001001111000011010111101011000001000101001101000

output:

1575457563138123

result:

ok answer is '1575457563138123'

Test #12:

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

input:

0100110011001000011110101101111111010000110011

output:

25282969203030

result:

ok answer is '25282969203030'

Test #13:

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

input:

0011001100000111010111101001101000000110111100011100

output:

2510541523074945

result:

ok answer is '2510541523074945'

Test #14:

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

input:

1110010111100

output:

1590

result:

ok answer is '1590'

Test #15:

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

input:

00001101101

output:

9823

result:

ok answer is '9823'

Test #16:

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

input:

111000100011100101111000

output:

2530965

result:

ok answer is '2530965'

Test #17:

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

input:

010110100001111011110000010001000110110100111110

output:

1079566051429651

result:

ok answer is '1079566051429651'

Test #18:

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

input:

10111101011110111100100000011011000001001111100001011

output:

13411286390164303

result:

ok answer is '13411286390164303'

Test #19:

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

input:

10111100100110010011110100100000101010110000010100

output:

27591604197404888

result:

ok answer is '27591604197404888'

Test #20:

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

input:

01000010011100100101100000000001001000

output:

133222173689

result:

ok answer is '133222173689'

Test #21:

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

input:

1111101110010000011011011000101

output:

14492834361

result:

ok answer is '14492834361'

Test #22:

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

input:

110100110001011000101101011

output:

15134266

result:

ok answer is '15134266'

Test #23:

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

input:

01101001101011101101101

output:

2960772

result:

ok answer is '2960772'

Test #24:

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

input:

11110101100010000100

output:

2912930

result:

ok answer is '2912930'

Test #25:

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

input:

0110101111110000110110010001

output:

851548114

result:

ok answer is '851548114'

Test #26:

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

input:

101001001101

output:

2277

result:

ok answer is '2277'

Test #27:

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

input:

11001110001000010110001100001111011111000

output:

25745895511785

result:

ok answer is '25745895511785'

Test #28:

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

input:

110110111011011100001001010011011000010011

output:

21689826093692

result:

ok answer is '21689826093692'

Test #29:

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

input:

10100111010111000101

output:

1074100

result:

ok answer is '1074100'

Test #30:

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

input:

00000010000011110111110101111111100

output:

134284782980

result:

ok answer is '134284782980'

Test #31:

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

input:

0110100100100111101000010

output:

115678982

result:

ok answer is '115678982'

Test #32:

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

input:

10110110010101100001111010110110

output:

196625955

result:

ok answer is '196625955'

Test #33:

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

input:

10100011010

output:

451

result:

ok answer is '451'

Test #34:

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

input:

1111000100

output:

24

result:

ok answer is '24'

Test #35:

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

input:

00001111101010001100100011101111001000000110110001100

output:

55928791305821883

result:

ok answer is '55928791305821883'

Test #36:

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

input:

00111110101001111011011011010111

output:

1604391490

result:

ok answer is '1604391490'

Test #37:

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

input:

0100111110110100110110000000101111001

output:

81289151237

result:

ok answer is '81289151237'

Test #38:

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

input:

1101101010011110010

output:

676819

result:

ok answer is '676819'

Test #39:

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

input:

000010001100010110011110000011101001110000110101101110

output:

236494750473271977

result:

ok answer is '236494750473271977'

Test #40:

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

input:

001011011110

output:

11243

result:

ok answer is '11243'

Test #41:

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

input:

1101110111011101

output:

17479

result:

ok answer is '17479'

Test #42:

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

input:

11011001110000101101

output:

482124

result:

ok answer is '482124'

Test #43:

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

input:

0110100111110001101101

output:

1101916

result:

ok answer is '1101916'

Test #44:

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

input:

111110000000000100111010000110110011101111011001

output:

1350318850097835

result:

ok answer is '1350318850097835'

Test #45:

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

input:

01101111111001000000

output:

4524495

result:

ok answer is '4524495'

Test #46:

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

input:

1010111100010001111001010111010100000001011000000000011

output:

342091330255876309

result:

ok answer is '342091330255876309'

Test #47:

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

input:

0011101100010111011001100001011111010000101010011000110

output:

488508015662352479

result:

ok answer is '488508015662352479'

Test #48:

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

input:

1111100101100011000011100000010010010001011000011100010

output:

552697917399006612

result:

ok answer is '552697917399006612'

Test #49:

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

input:

0101010110111111100011011011011100111111001101010111111

output:

310794647125722338

result:

ok answer is '310794647125722338'

Test #50:

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

input:

1110111011011100010110111001011110000111111001001110000

output:

340531374829154662

result:

ok answer is '340531374829154662'

Test #51:

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

input:

1101011001111000101001010100100101110110111001101010010

output:

153703145787415367

result:

ok answer is '153703145787415367'

Test #52:

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

input:

0110110000001011101001011111111100000000110001001000001

output:

230399308022984473

result:

ok answer is '230399308022984473'

Test #53:

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

input:

0001010000110111000101110101111100100101110000010010110

output:

477289782382961687

result:

ok answer is '477289782382961687'

Test #54:

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

input:

1100110100000010000110010100011001011110100110001101001

output:

32742663819349731

result:

ok answer is '32742663819349731'

Test #55:

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

input:

1001100111101001010011110100010100100111011110110010001

output:

504927465900691460

result:

ok answer is '504927465900691460'

Test #56:

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

input:

0001101010101110101100000111001010101000011011101100111

output:

45814239190627479

result:

ok answer is '45814239190627479'

Test #57:

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

input:

0101100001010101101100101100001110110111011101110010010

output:

119389948060291287

result:

ok answer is '119389948060291287'

Test #58:

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

input:

0111101001110011100101011011001001111001100001011010101

output:

209380660973652414

result:

ok answer is '209380660973652414'

Test #59:

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

input:

0011101111010111111100100000000010001000010101100011001

output:

112711787535267718

result:

ok answer is '112711787535267718'

Test #60:

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

input:

1000000010000011101010101111101101010100111011111100100

output:

113060494433323880

result:

ok answer is '113060494433323880'

Test #61:

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

input:

0100000100100110110011001001011101100110111001001110111

output:

233978371494861166

result:

ok answer is '233978371494861166'

Test #62:

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

input:

1110110101110010100100001011011001000011010110001100011

output:

195740199453835543

result:

ok answer is '195740199453835543'

Test #63:

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

input:

1000001111001100101010100001101011111001110110111000001

output:

6674447445449032

result:

ok answer is '6674447445449032'

Test #64:

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

input:

1111010010010010101011110001000001000011000111111011110

output:

27482870241374655

result:

ok answer is '27482870241374655'

Test #65:

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

input:

0011111100101111011111010111100110110010001011100110000

output:

244411899637632648

result:

ok answer is '244411899637632648'

Test #66:

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

input:

1011100111111100011001011100100000111001011001111001111

output:

101798322115572895

result:

ok answer is '101798322115572895'

Test #67:

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

input:

0101010000100001111011011000000010101101101001011000100

output:

470951868793563220

result:

ok answer is '470951868793563220'

Test #68:

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

input:

0101001000000011101001011110011101110010011001001001010

output:

27222152140268876

result:

ok answer is '27222152140268876'

Test #69:

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

input:

0100010001110100101000101010100011100101110111001110011

output:

246300960826437380

result:

ok answer is '246300960826437380'

Test #70:

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

input:

1101100011110111001110111111110011110011110010000100000

output:

658109745667120887

result:

ok answer is '658109745667120887'

Test #71:

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

input:

1000010101011000010001110110011010000011110001010101011

output:

482703240276676562

result:

ok answer is '482703240276676562'

Test #72:

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

input:

0011111001010011011101101010100001100001110010111111111

output:

1002075782371010585

result:

ok answer is '1002075782371010585'

Test #73:

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

input:

1110001101001000110011111001011101111100000000100011101

output:

361278349234609565

result:

ok answer is '361278349234609565'

Test #74:

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

input:

0100011100001000011111110010000101000001111001101010100

output:

56874688376383344

result:

ok answer is '56874688376383344'

Test #75:

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

input:

1110010111101100111111000001111111111010100001101011110

output:

56962299438155523

result:

ok answer is '56962299438155523'

Test #76:

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

input:

1010111000100101011000011111001111011101011111001000001

output:

478714042587854950

result:

ok answer is '478714042587854950'

Test #77:

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

input:

1111111000001000110011101101111110010101111110001001101

output:

461043595412184597

result:

ok answer is '461043595412184597'

Test #78:

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

input:

1110110101101011010110010001001100111011011101110000110

output:

95919384048798599

result:

ok answer is '95919384048798599'

Test #79:

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

input:

1010110010101101000010001101100101000011001001110111010

output:

57153857862611838

result:

ok answer is '57153857862611838'

Test #80:

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

input:

0001001010011011100000001111010000110001110100001100000

output:

113462598761170904

result:

ok answer is '113462598761170904'

Test #81:

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

input:

0001001001000000101111001001101111111011101011110110010

output:

473973570716799997

result:

ok answer is '473973570716799997'

Test #82:

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

input:

1101000010010000110100000110110101101101110101010110010

output:

142898349874998055

result:

ok answer is '142898349874998055'

Test #83:

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

input:

0111110000111000010101001110010101101111011111111011100

output:

119031467564851955

result:

ok answer is '119031467564851955'

Test #84:

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

input:

1010010100101101001100011110000000010010101110100110110

output:

230229266469055878

result:

ok answer is '230229266469055878'

Test #85:

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

input:

1011000011110100000100001101100001010101000111111101110

output:

119567173523160205

result:

ok answer is '119567173523160205'

Test #86:

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

input:

0000000011110101010000011100001101100100010110000111011

output:

958470984499970164

result:

ok answer is '958470984499970164'

Test #87:

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

input:

0100000110010100000100000100010001001101001100100110110

output:

115477762343815131

result:

ok answer is '115477762343815131'

Test #88:

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

input:

0000000110110001011101100101101001110010111001001010101

output:

961316327806191679

result:

ok answer is '961316327806191679'

Test #89:

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

input:

1111101101111110000011010101111100110111001110011011000

output:

163707073701853172

result:

ok answer is '163707073701853172'

Test #90:

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

input:

0000110000111111000011011110011100000101011000100111001

output:

975602855581187717

result:

ok answer is '975602855581187717'

Test #91:

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

input:

1101011111101011000101011110001010100110101010000000100

output:

650149260978010383

result:

ok answer is '650149260978010383'

Test #92:

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

input:

1001011000101011010000000101000010110101010110001011000

output:

959643810404533976

result:

ok answer is '959643810404533976'

Test #93:

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

input:

0000011110010111110010101010111111000110110001011001111

output:

984149918349073754

result:

ok answer is '984149918349073754'

Test #94:

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

input:

1101111001001100100100011110110011010100110100110000011

output:

236160722843994107

result:

ok answer is '236160722843994107'

Test #95:

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

input:

1011001000001111000101101000101001001110001010101101011

output:

56861222811013545

result:

ok answer is '56861222811013545'

Test #96:

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

input:

0110000000110010100110100110010010110110011010010111110

output:

84056891403366476

result:

ok answer is '84056891403366476'

Test #97:

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

input:

0101111101000001001111110000000011000010100010000100100

output:

469818122825359841

result:

ok answer is '469818122825359841'

Test #98:

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

input:

1000011010011010110001000100000100010100010000110110001

output:

35529982569949526

result:

ok answer is '35529982569949526'

Test #99:

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

input:

1001001111011010000101110111110100000010010101011000111

output:

472809243947334243

result:

ok answer is '472809243947334243'

Test #100:

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

input:

1010110101110001101011111000111001011110011010001001100

output:

1028954002940322989

result:

ok answer is '1028954002940322989'

Test #101:

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

input:

1101001000001010111010010110010110001001010010111011110

output:

30615019642820979

result:

ok answer is '30615019642820979'

Test #102:

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

input:

0111000011110011100001101111010000010111000100011001100

output:

119551775288576421

result:

ok answer is '119551775288576421'

Test #103:

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

input:

0011000000110100011110001100101010100101110101110110011

output:

60850843056449404

result:

ok answer is '60850843056449404'

Test #104:

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

input:

1000110110000010000001101000010100011000100001111110010

output:

37632585041790327

result:

ok answer is '37632585041790327'

Test #105:

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

input:

1111011001010001100010100001100011000110100011011100111

output:

103903746533680139

result:

ok answer is '103903746533680139'

Test #106:

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

input:

0100100110000110010110000111101010001111000010110001011

output:

32386467116092078

result:

ok answer is '32386467116092078'

Test #107:

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

input:

0000011111100100110011111110000110100101001111001000100

output:

237043645720778913

result:

ok answer is '237043645720778913'

Test #108:

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

input:

1011010110111101011011011110000110110011100011110011100

output:

1007442418195155622

result:

ok answer is '1007442418195155622'

Test #109:

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

input:

1111100001010111001110110111111111001001000100010101011

output:

215670317087649983

result:

ok answer is '215670317087649983'

Test #110:

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

input:

1000010111001001101011010000101111110001011000001110010

output:

236332100231226380

result:

ok answer is '236332100231226380'

Test #111:

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

input:

1110110000101111110111101100001000011100100110011010111

output:

116453566900826807

result:

ok answer is '116453566900826807'

Test #112:

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

input:

1010111111010010111100010010100100010010100010000111010

output:

58476909070314295

result:

ok answer is '58476909070314295'

Test #113:

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

input:

1101110001000001110100000101000001011111001110001011000

output:

683123243490147015

result:

ok answer is '683123243490147015'

Test #114:

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

input:

1011011101111111101101101111111100101010101110111100100

output:

1100805618234842319

result:

ok answer is '1100805618234842319'

Test #115:

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

input:

1111111010101010001011001101100111011101110111100010101

output:

463394476702547913

result:

ok answer is '463394476702547913'

Test #116:

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

input:

1010101100101001001010111110110010000100101011110111001

output:

486178255266595862

result:

ok answer is '486178255266595862'

Test #117:

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

input:

1100001001100000100011011001101000111000011110010000100

output:

1608227835548415

result:

ok answer is '1608227835548415'

Test #118:

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

input:

0111010101010111011110010111101110101100001001011010111

output:

57282133674587285

result:

ok answer is '57282133674587285'

Test #119:

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

input:

0111101010111111001011111011010111111111101100100111101

output:

7520791731175341

result:

ok answer is '7520791731175341'

Test #120:

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

input:

1111001111101011111000011001110000010100110001001111011

output:

12963874810182562

result:

ok answer is '12963874810182562'

Test #121:

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

input:

0000100010001011110010111111000001100100000110011111100

output:

235516904211974653

result:

ok answer is '235516904211974653'

Test #122:

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

input:

0111111001011100111001011010010111101001010111100000111

output:

56940547985858450

result:

ok answer is '56940547985858450'

Test #123:

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

input:

1001011100101111110000111000101000110100000101011011011

output:

9508187045503141

result:

ok answer is '9508187045503141'

Test #124:

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

input:

0100011110011100101011010011010000100010101110111100001

output:

237779821351795630

result:

ok answer is '237779821351795630'

Test #125:

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

input:

1000001110100111100001111000111100010000000011000010100

output:

112937530583435433

result:

ok answer is '112937530583435433'

Test #126:

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

input:

1111111110110001011011101101111011011101010011001010101

output:

467229756907337705

result:

ok answer is '467229756907337705'

Test #127:

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

input:

0000011100110100101111010101001000101110111000011110100

output:

236402366381509743

result:

ok answer is '236402366381509743'

Test #128:

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

input:

0000001000111101111011001100010101000100010010111010010

output:

472633861567479473

result:

ok answer is '472633861567479473'

Test #129:

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

input:

0000101110000011011111001010101011110000011010000001100

output:

3256691987680868

result:

ok answer is '3256691987680868'

Test #130:

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

input:

0001101001100001110100001100101110100111100110001010100

output:

2030033780635088

result:

ok answer is '2030033780635088'

Test #131:

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

input:

0011100110011010010001010001110010001110111101001010001

output:

121942029476783851

result:

ok answer is '121942029476783851'

Test #132:

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

input:

0110111000101001110001100100100101110111100111000000110

output:

55941271769078439

result:

ok answer is '55941271769078439'

Test #133:

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

input:

1110100011001000010010001111110101011001000010100101101

output:

44957871017500731

result:

ok answer is '44957871017500731'

Test #134:

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

input:

1001001011010001000101111110001001010111001100110100000

output:

972520063120799784

result:

ok answer is '972520063120799784'

Test #135:

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

input:

1011001101011010110010001101110000111100111111100011100

output:

1013778193507689759

result:

ok answer is '1013778193507689759'

Test #136:

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

input:

0001010010111001000100111001110011010111000001001101101

output:

973542478447335749

result:

ok answer is '973542478447335749'

Test #137:

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

input:

0000111001111101111100001010110011001001100011100111000

output:

117529514316631269

result:

ok answer is '117529514316631269'

Test #138:

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

input:

0000001011000000100000011011101110111111101101011000010

output:

472225732377242995

result:

ok answer is '472225732377242995'

Test #139:

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

input:

0111000110100101111101111001011001001110000001111000110

output:

1370589048270308

result:

ok answer is '1370589048270308'

Test #140:

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

input:

1100000001110111000011110000010111101110100001000100111

output:

235214220087284553

result:

ok answer is '235214220087284553'

Test #141:

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

input:

1100110011111010111010110111001000100010101110111111010

output:

33918826242661127

result:

ok answer is '33918826242661127'

Test #142:

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

input:

1000011111001000010110110000001010011100010111011000111

output:

12862233313423715

result:

ok answer is '12862233313423715'

Test #143:

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

input:

1010001111011111011001101111101111001111001010110001100

output:

1052604810589421891

result:

ok answer is '1052604810589421891'

Test #144:

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

input:

0001110110100010101001111111100011101001100101110110101

output:

1037003242280560063

result:

ok answer is '1037003242280560063'

Test #145:

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

input:

0011000001011011000100010100011011111100100010011000110

output:

28921255989786917

result:

ok answer is '28921255989786917'

Test #146:

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

input:

1111110000100010100110111011101111010001010011001100101

output:

453960380009757073

result:

ok answer is '453960380009757073'

Test #147:

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

input:

1101111010010101110100110010110100110101110101000101101

output:

60318087487960908

result:

ok answer is '60318087487960908'

Test #148:

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

input:

0000101010011000010010001101011011001100110101111100000

output:

56357311116320279

result:

ok answer is '56357311116320279'

Test #149:

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

input:

0111101101011111011110110100101001101101011000011100010

output:

19044448300037868

result:

ok answer is '19044448300037868'

Test #150:

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

input:

1000001111100011010000010111110001100001111101010011000

output:

56502219956718796

result:

ok answer is '56502219956718796'

Test #151:

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

input:

0000010100111001111100111100111110111001110000000111001

output:

457049978661045

result:

ok answer is '457049978661045'

Test #152:

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

input:

1001110100101101111110010111100110100011111110100011111

output:

527706124622374356

result:

ok answer is '527706124622374356'

Test #153:

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

input:

0011011000001001110000111000101010101001110000110100100

output:

234235411649229400

result:

ok answer is '234235411649229400'

Test #154:

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

input:

0000001110111000110000000101111001011010011010001110011

output:

960468953001073061

result:

ok answer is '960468953001073061'

Test #155:

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

input:

0101010100010000100010001101001001100101100111000000010

output:

113197932455892123

result:

ok answer is '113197932455892123'

Test #156:

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

input:

0100000100110110110111110001001000100110011111111111100

output:

56258604249561092

result:

ok answer is '56258604249561092'

Test #157:

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

input:

0110010101001001011111010110101101000001101110101010000

output:

481514670797154673

result:

ok answer is '481514670797154673'

Test #158:

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

input:

0110010000011110101110111001000101111101011000001110100

output:

30645631687577330

result:

ok answer is '30645631687577330'

Test #159:

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

input:

1010101000100101000111110011001001010101001100011011011

output:

70565125173310421

result:

ok answer is '70565125173310421'

Test #160:

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

input:

1111011010000111000010101111011001110001101001010000100

output:

327062124755364573

result:

ok answer is '327062124755364573'

Test #161:

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

input:

0110010001011101101101111010101110111111001101000101101

output:

29597683810049277

result:

ok answer is '29597683810049277'

Test #162:

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

input:

1001010111000000000011101001100101001001111000010111001

output:

55220259694484979

result:

ok answer is '55220259694484979'

Test #163:

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

input:

0011100111010000110000110011110011001001001000000010101

output:

90394945214765619

result:

ok answer is '90394945214765619'

Test #164:

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

input:

1101000011011111110110101100001101111011010110010010000

output:

596617079424181911

result:

ok answer is '596617079424181911'

Test #165:

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

input:

1111111010001101111110111010110111001110010011011100001

output:

50083622171102228

result:

ok answer is '50083622171102228'

Test #166:

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

input:

0011010001010110000100010001100011000111010011110011011

output:

187003693220955610

result:

ok answer is '187003693220955610'

Test #167:

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

input:

0010101000010000010000011011010001110100101100100000001

output:

113191231716715822

result:

ok answer is '113191231716715822'

Test #168:

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

input:

1100001011110110100000111000111111100010001111110010010

output:

118010957329767047

result:

ok answer is '118010957329767047'

Test #169:

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

input:

0010100010000001010101100111001010100001010010011111001

output:

113813697938347140

result:

ok answer is '113813697938347140'

Test #170:

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

input:

0100111001011111100010001000000101110011101101111100011

output:

283288967745192732

result:

ok answer is '283288967745192732'

Test #171:

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

input:

1101111001010001001000000111010110010011111100011101010

output:

168057410190156799

result:

ok answer is '168057410190156799'

Test #172:

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

input:

0111010011010011001010000011101100001000110010001001001

output:

72484483465477473

result:

ok answer is '72484483465477473'

Test #173:

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

input:

0011011000101100111010100001001101111111011000011011011

output:

193733824217609818

result:

ok answer is '193733824217609818'

Test #174:

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

input:

0010100100101100010000001000100100010100001000111010001

output:

113569668020615739

result:

ok answer is '113569668020615739'

Test #175:

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

input:

1000000101010001111010011000000010000111110101011000011

output:

470390601721268092

result:

ok answer is '470390601721268092'

Test #176:

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

input:

0010111110000001001100011101000101011100010100101001010

output:

472913739534489680

result:

ok answer is '472913739534489680'

Test #177:

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

input:

0001101000100101100000010011100010010100111010010100001

output:

55716846904751546

result:

ok answer is '55716846904751546'

Test #178:

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

input:

0010011110011011100100011011000110101101100101000100010

output:

59035527014036148

result:

ok answer is '59035527014036148'

Test #179:

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

input:

1000110101011110101001001010010000011100100110110100000

output:

971861260155243224

result:

ok answer is '971861260155243224'

Test #180:

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

input:

0011100000110110110000010011001101111010100000010010001

output:

113631688281453836

result:

ok answer is '113631688281453836'

Test #181:

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

input:

1110101110000111111001011011101000000111010000011000010

output:

75860085383774662

result:

ok answer is '75860085383774662'

Test #182:

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

input:

0110011001000111100101000100001111110000110110110101011

output:

118860257267084949

result:

ok answer is '118860257267084949'

Test #183:

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

input:

0111010101010001110101011101011110111101001100000001100

output:

151521188780630693

result:

ok answer is '151521188780630693'

Test #184:

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

input:

1110101010100101010011100110110000010001111111011011100

output:

309090990161707970

result:

ok answer is '309090990161707970'

Test #185:

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

input:

0100011100110010011011001100000011011010100101111110110

output:

125757479501749147

result:

ok answer is '125757479501749147'