Task: | HIIT remains |
Sender: | ContinuedLife |
Submission time: | 2016-05-28 16:00:24 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.09 s | details |
#2 | WRONG ANSWER | 0.10 s | details |
#3 | WRONG ANSWER | 0.08 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
Compiler report
input/code.cpp: In function 'int solve(int, std::string&, int)': input/code.cpp:9:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(start == input.size()) return 0; ^
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 HIIT 15 int table[20][100000]; int solve(int curr, string& input, int start){ if(start == input.size()) return 0; if(table[curr][start]) return table[curr][start]; int last = 1; for( ; last < 4; ++last) if((1 << last)&HIIT) break; int ans = 0; switch(last){ case 1: if(input[start] == 'T') ans += 1; ans += solve(curr, input, start + 1); break; case 2: if(input[start] == 'I') ans += solve(curr | (1<<1), input, start + 1); ans += solve(curr, input, start+1); break; case 3: if(input[start] == 'I') ans += solve(curr | (1<<2), input, start + 1); ans += solve(curr, input, start+1); break; case 4: if(input[start] == 'H') ans += solve(curr | (1<<3), input, start + 1); ans += solve(curr, input, start+1); break; } table[curr][start] = ans; return ans; } int main(){ _ int TC; cin >> TC; while(TC--){ string input, str; cin >> input; for(int i = 0; i < int(input.size()); ++i){ if(input[i] == 'H' || input[i] == 'I' || input[i] == 'T'){ str.push_back(input[i]); // cout << "get here" << endl; } } memset(table, 0, sizeof table); int curr = 0; cout << solve(curr, str, 0) << endl; } return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 IIITIIIHITHTHIIITIII HIHIIIIIIHIIITHIIIII ITTIIIITIIIIIIITIIIT IITHITITIHHIITTTIIII ... |
correct output |
---|
12 84 0 37 96 ... |
user output |
---|
4 1 5 6 7 ... |
Test 2
Verdict: WRONG ANSWER
input |
---|
100 TIIHHITTITITIHTHIIIITHIHHIIHTI... |
correct output |
---|
606723862 621369559 655243897 550750615 717769300 ... |
user output |
---|
269 237 254 253 232 ... |
Test 3
Verdict: WRONG ANSWER
input |
---|
10 TTHTHHTIIIIIITHIIHIITITTITTIIH... |
correct output |
---|
64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 ... |
user output |
---|
25296 24919 24911 25111 25129 ... |
Test 4
Verdict: WRONG ANSWER
input |
---|
3 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
correct output |
---|
781234375000000000 4999750003 0 |
user output |
---|
25000 1 14285 |