CSES - HIIT Open 2016 - Results
Submission details
Task:Bit strings
Sender:ContinuedLife
Submission time:2016-05-28 12:26:32 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2--details
#3--details
#4ACCEPTED0.74 sdetails
#5--details
#6--details

Code

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(6);
using namespace std;
int main(){ _
int n; cin >> n;
/*
for(int i=0; i<n; i++){
string str;
cin >> str;
int *array = new int[str.length()];
for(int j=0; j<str.length(); j++){
*(array+j) = atoi(str[j]);
cout << *(array+j);
}
cout << endl;
}*/
for(int i = 0; i < n; ++i){
string str;
cin >> str;
int n=str.size();
vector<int> vi(n);
vector<int> tmp(n);
vector<int> result(n+1);
for(int i = 0; i < n; ++i){
vi[i] = str[i] - '0';
tmp[i] = vi[i];
if(vi[i] == 0){
result[0]++;
} else {
result[1]++;
}
}
for(int j=1; j<n; ++j){
for(int k=0; k<n-j; k++){
tmp[k+j] += vi[k];
result[tmp[k+j]]++;
}
}
for(int p=0; p<n+1; ++p){
cout << result[p] << " ";
}
cout << endl;
}
return 0;
}

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)