Task: | Bit strings |
Sender: | ContinuedLife |
Submission time: | 2016-05-28 14:25:34 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | ACCEPTED | 0.97 s | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:16:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int right = left + 1; right < str.size(); ++right){ ^ input/code.cpp:23:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i =0; i < ans.size(); ++i){ ^
Code
#include <bits/stdc++.h> #define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(6); using namespace std; #define maxN 1e5 int main(){ _ int TC; cin >> TC; while(TC--){ string str; cin >> str; vector<int> ans(str.size()+1, 0); //cout << str.size() << endl; for(int left = -1; left < int(str.size()); ++left){ // cout << "get here> " << endl; int acc = 0; for(int right = left + 1; right < str.size(); ++right){ // cout << str[right] << " "; // cout << "get here> " << endl; if(str[right] == '1'){ ++acc; } ans[acc] += 1; } } for(int i =0; i < ans.size(); ++i){ if(i) cout << " "; cout << ans[i]; } 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: TIME LIMIT EXCEEDED
input |
---|
1 001010110001110001110000110011... |
correct output |
---|
99028 198023 199224 198569 199... |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
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: TIME LIMIT EXCEEDED
input |
---|
10 110101000110110101011011101010... |
correct output |
---|
9955 20073 20158 19923 20014 1... |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 111111111111111111111111111111... |
correct output |
---|
968 100966 100967 100965 10096... |
user output |
---|
(empty) |