CSES - HIIT Open 2016 - Results
Submission details
Task:Bit strings
Sender:LTR
Submission time:2016-05-28 11:37:28 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2--details
#3--details
#4ACCEPTED0.59 sdetails
#5--details
#6--details

Code

#include <iostream>
#include <vector>
#include <cstdio>
#include <string>

int main()
{
	int t;
	std::cin >> t;
	for (int i = 0; i < t; ++i) {
		std::string s;
		std::cin >> s;

		std::vector<int> seqs;
		seqs.reserve(s.size() + 1);
		std::vector<int> count(s.size() + 1, 0);

		for (auto c : s) {
			int ic = c - '0';
			for (auto& seq : seqs) {
				seq += ic;
			}
			seqs.push_back(ic);
			for (auto& seq : seqs) {
				count[seq]++;
			}
		}

		for (auto c : count) {
			std::cout << c << " ";
		}
		std::cout << std::endl;
	}
}

Test details

Test 1

Verdict: ACCEPTED

input
20
00011000100111001100
00001001111111100010
10110011110101111101
01111011010010100111
...

correct output
21 33 39 30 23 20 25 7 12 0 0 ...

user output
21 33 39 30 23 20 25 7 12 0 0 ...

Test 2

Verdict:

input
1
001010110001110001110000110011...

correct output
99028 198023 199224 198569 199...

user output
(empty)

Test 3

Verdict:

input
1
111010111001001100100101011110...

correct output
99270 199585 198291 199812 198...

user output
(empty)

Test 4

Verdict: ACCEPTED

input
20
001001010011101100110111110010...

correct output
5022 10235 10021 9985 10019 99...

user output
5022 10235 10021 9985 10019 99...

Test 5

Verdict:

input
10
110101000110110101011011101010...

correct output
9955 20073 20158 19923 20014 1...

user output
(empty)

Test 6

Verdict:

input
1
111111111111111111111111111111...

correct output
968 100966 100967 100965 10096...

user output
(empty)