QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#723178#9614. 分治Aaronwrq40 1ms3632kbC++14460b2024-11-07 21:21:282024-11-07 21:21:28

Judging History

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

  • [2024-11-07 21:21:28]
  • 评测
  • 测评结果:40
  • 用时:1ms
  • 内存:3632kb
  • [2024-11-07 21:21:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

string N;
int l, n, ans;

void Solve(int n, int c, int maxc) {
	if (n == 1) {ans += maxc + 1; return;}
	Solve((n + 1) >> 1, c + 1, max(maxc, c + 1));
	Solve(n >> 1, 0, maxc);
	return;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> N; l = N.length();
	for (int i = 0; i < l; ++i) n = n << 1 | (N[i] == '1');
	Solve(n, 0, 0);
	cout << ans << "\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

110

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: 10
Accepted
time: 0ms
memory: 3572kb

input:

101

output:

12

result:

ok 1 number(s): "12"

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #3:

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

input:

111110

output:

198

result:

ok 1 number(s): "198"

Test #4:

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

input:

1001001

output:

253

result:

ok 1 number(s): "253"

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #5:

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

input:

10100011000100111

output:

386882

result:

ok 1 number(s): "386882"

Test #6:

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

input:

111010011111010110

output:

1107742

result:

ok 1 number(s): "1107742"

Subtask #4:

score: 0
Memory Limit Exceeded

Test #7:

score: 0
Memory Limit Exceeded

input:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

output:


result:


Subtask #5:

score: 0
Skipped

Dependency #3:

100%
Accepted

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #5:

0%

Subtask #8:

score: 0
Skipped

Dependency #6:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%