Code Submission Evaluation System Login

CSES - HIIT Open 2016

HIIT Open 2016

Contest start:2016-05-28 11:00:00
Contest end:2016-05-28 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2016-05-28 11:43:19
2016-05-28 11:37:28
Task:Bit strings
Sender:LTR
Submission time:2016-05-28 11:43:19
Status:READY
Result:TIME LIMIT EXCEEDED

Show test data

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;
				count[seq]++;
			}
			seqs.push_back(ic);
			count[ic]++;
		}

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