QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#308810#8129. Binary Sequenceucup-team2112#AC ✓50ms10680kbC++201.2kb2024-01-20 13:12:052024-01-20 13:12:06

Judging History

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

  • [2024-01-20 13:12:06]
  • 评测
  • 测评结果:AC
  • 用时:50ms
  • 内存:10680kb
  • [2024-01-20 13:12:05]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;
std::vector<std::string > res = {"0", "1", "11"};
int o = 2;

std::string binary(int n) {
    std::string s;
    while(n) {
        s += (n % 2) + '0';
        n /= 2;
    }
    std::reverse(s.begin(), s.end());
    return s;
}

void get_string(std::string &s) {
    int n = s.size();
    std::string t;
    for (int i = 0; i < n; i += 1) {
        int j = i;
        int c = 0;
        while(j < n && s[j] == s[i]) {
            j += 1;
            c += 1;
        }
        t += binary(c) + s[i];
        i = j - 1;
    }
    res.push_back(t);
};

void solve(){
    while(res[o].size() < 1000000 || res[o - 1].size() < 1000000) {
        get_string(res[o]);
        o += 1;
    }
    i64 n;
    int m;
    std::cin >> n >> m;
    if (n >= 37) {
        if (n % 2) n = 37;
        else n = 36;
    }
    if (m >= res[n].size()) {
        std::cout << 0 << "\n";
    }
    else {
        std::cout << res[n][int(res[n].size()) - 1 - m] << "\n";
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    int T;
    std::cin >> T;
    while(T--) {
        solve();
    }
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 32ms
memory: 10588kb

input:

10
4 0
4 1
4 2
4 3
4 4
4 5
4 6
6 3
6 7
118999881999119725 3

output:

1
1
0
1
1
1
0
1
1
0

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 32ms
memory: 10560kb

input:

10
28 69772
10 7908
4 3198
4 85913
14 52729
3 20445
9 88912
17 23743
25 37356
2 97697

output:

0
0
0
0
0
0
0
0
0
0

result:

ok 10 numbers

Test #3:

score: 0
Accepted
time: 31ms
memory: 10680kb

input:

100
29 110358
18 13645
18 590344
36 550462
11 133055
8 769352
11 265432
7 158530
12 29189
2 830361
11 584395
31 693707
7 879812
19 25069
21 616926
3 85158
31 675739
17 118385
24 315535
29 59615
10 33445
17 609235
8 738138
20 209540
4 287616
32 522302
26 959741
5 453537
27 74313
28 296289
28 857972
2...

output:

0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 50ms
memory: 10572kb

input:

100000
702433635413308636 962533
864089450531108488 538792
262747333715821506 454514
859830947243984718 105219
365621373252206174 447331
890829905503831899 507146
116987306031929573 154370
157986473366693144 364746
502917586764426513 49981
874588963478161584 594867
467219058104100510 790503
11034861...

output:

1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
1
0
1
1
1
1
1
1
1
0
1
1
1
0
0
0
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
0
0
1
0
1
1
1
1
1
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
0
0
0
0
1
1
1
0
0
1
...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed