QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#309932#8129. Binary Sequenceucup-team484#WA 17ms12776kbC++17980b2024-01-20 22:47:332024-01-20 22:47:33

Judging History

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

  • [2024-01-20 22:47:33]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:12776kb
  • [2024-01-20 22:47:33]
  • 提交

answer

#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define st first
#define nd second
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
vector<string> arr;

void solve() {
	ll n, m; cin >> n >> m;
	for (int i = 0; i < size(arr); i++) {
		if (size(arr[i]) > m && (i + 1) % 2 == n % 2) {
			cout << arr[i][size(arr[i]) - m - 1] << "\n";
			return;
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	arr.push_back("1");
	for (int i = 1;; i++) {
		string s;
		for (int j = 0, jj = 0; j < size(arr[i - 1]); j = jj) {
			while (jj < size(arr[i - 1]) && arr[i - 1][j] == arr[i - 1][jj])
				jj++;
			int x = jj - j;
			for (int k = 31 - __builtin_clz(x); k >= 0; k--)
				s.push_back('0' + ((x >> k) & 1));
			s.push_back(arr[i - 1][j]);
		}
		arr.push_back(s);
		if (size(arr[i - 1]) > N)
			break;
	}
	int t; cin >> t; while (t--) solve();
}

详细

Test #1:

score: 100
Accepted
time: 17ms
memory: 12776kb

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: -100
Wrong Answer
time: 8ms
memory: 12776kb

input:

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

output:

1
1
1
1
1
1
1
1
1
1

result:

wrong answer 1st numbers differ - expected: '0', found: '1'