QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#719077#2511. Pyramidyuto1115#RE 0ms1644kbC++20480b2024-11-06 22:20:572024-11-06 22:21:01

Judging History

This is the latest submission verdict.

  • [2024-11-06 22:21:01]
  • Judged
  • Verdict: RE
  • Time: 0ms
  • Memory: 1644kb
  • [2024-11-06 22:20:57]
  • Submitted

answer

#include <cstdio>

const int N = 10005;
int t, n, a[N], k;

int main() {
	scanf("%d", &t);
	while (t--) {
		scanf("%d%d", &n, &k);
		a[0] = k - 1;
		int start = 0, end = 1, len = 0, ans = 0;
		for (int i = 0; i < n; ++i) {
			if (i) {
				for (int j = end; j >= start; --j) {
					a[j] += a[j - 1] >> 1;
					a[j - 1] -= a[j - 1] >> 1;
				}
				while (a[start] == 1) ++start;
				while (a[end]) ++end;
			}
			if (a[ans] & 1) ans += 1;
		}
		printf("%d\n", ans);
	}
	return 0;
}

詳細信息

Test #1:

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

input:

2
5 1
5 2

output:

0
1

result:

ok 2 lines

Test #2:

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

input:

3
5 3
5 4
5 5

output:

2
3
2

result:

ok 3 lines

Test #3:

score: -100
Runtime Error

input:

20
10000 100000000
9999 98987654
1234 5678
5000 20091234
1 100
1 101
7777 77777777
5890 98767897
106 67898765
2 4
9999 98987655
9999 98987656
9999 98987657
9999 98987658
9999 98987659
9999 98987660
9999 98987661
9999 98987662
9999 98987663
9999 98987664

output:


result: