QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#308853#8129. Binary Sequenceucup-team173#AC ✓69ms10156kbC++171.5kb2024-01-20 13:23:462024-01-20 13:23:47

Judging History

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

  • [2024-01-20 13:23:47]
  • 评测
  • 测评结果:AC
  • 用时:69ms
  • 内存:10156kb
  • [2024-01-20 13:23:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define Mp make_pair
#define pb push_back
#define SZ(a) (int(a.size()))

typedef long long ll;
typedef double db;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
#define log(...) fprintf(stderr, __VA_ARGS__)
std::mt19937_64 gen(std::chrono::system_clock::now().time_since_epoch().count());
ll get(ll l, ll r) { std::uniform_int_distribution<ll> dist(l, r); return dist(gen); }

signed main() {
    atexit([](){cerr << "time: " << (db)clock()/CLOCKS_PER_SEC << "s\n";});
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    vector<string> s; s.pb("1");
    for(int i = 1; SZ(s[i - 1]) <= 1.5e6; i++) {
        s.pb("");
        for(int j = 0, k; j < SZ(s[i - 1]); j = k + 1) {
            k = j; while(k + 1 < SZ(s[i - 1]) && s[i - 1][k + 1] == s[i - 1][k]) k++;
            string num;
            for(int t = k - j + 1; t; t >>= 1) num += t % 2 + '0';
            reverse(num.begin(), num.end());
            s[i] += num + s[i - 1][j];
        }
        // cerr << SZ(s[i]) << '\n';
    }
    for(int i = 0; i < SZ(s); i++) reverse(s[i].begin(), s[i].end());
    cerr << s[5] << '\n';
    int _; cin >> _; for(int cas = 1; cas <= _; cas++) {
        ll n, m;
        cin >> n >> m;
        if(n > SZ(s)) {
            n = SZ(s) - (n % 2 != SZ(s) % 2);
        }
        if(m >= SZ(s[n - 1])) {
            cout << "0\n";
        } else {
            cout << s[n - 1][m] << '\n';
        }
    }
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 53ms
memory: 10016kb

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: 58ms
memory: 9980kb

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: 57ms
memory: 10152kb

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: 69ms
memory: 10156kb

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