# HIIT Open 2016

 Start: 2016-05-28 11:00:00 End: 2016-05-28 16:00:00

CSES - HIIT Open 2016 - Results
History
2016-05-28 12:20:52
 Task: HIIT remains Sender: Anonyymit Algoritmistit Submission time: 2016-05-28 12:20:52 Language: C++ Status: READY Result: ACCEPTED

## Test results

 test verdict time (s) #1 ACCEPTED 0.05 / 1.00 details #2 ACCEPTED 0.06 / 1.00 details #3 ACCEPTED 0.07 / 1.00 details #4 ACCEPTED 0.05 / 1.00 details

## Code

```#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

ll t;
cin >> t;

for(int x = 0; x < t; x++) {

string s;
cin >> s;
ll n = s.length();

vector<ll> hiit;
vector<ll> iit;
vector<ll> it;
vector<ll> t;

hiit.resize(n);
iit.resize(n);
it.resize(n);
t.resize(n);

if (s[n-1] == 'T') t[n-1]++;

for(int j = n-2; j >= 0; j--) {
t[j]+=t[j+1];

if (s[j] == 'T') {
t[j]++;
}

}

for(int j = n-2; j >= 0; j--) {
it[j] += it[j+1];
if (s[j] == 'I') {
it[j] += t[j+1];
}

}

for(int j = n-2; j >= 0; j--) {
iit[j] += iit[j+1];
if (s[j] == 'I') {
iit[j] += it[j+1];
}
}

for(int j = n-2; j >= 0; j--) {
hiit[j] += hiit[j+1];
if (s[j] == 'H') {
hiit[j] += iit[j+1];
}
}
/*for(int i = 0; i < n; i++) {
cout << hiit[i] << " ";
}*/

//cout << endl;
cout << hiit[0] << endl;
}

}```

## Test details

### Test 1

Verdict: ACCEPTED

input
```100 IIITIIIHITHTHIIITIII HIHIIIIIIHIIITHIIIII ITTIIIITIIIIIIITIIIT IITHITITIHHIITTTIIII HTTTHIHTHTIHIHIHITIT TTIIHTHIHHHHTTHTIHIH IHTITTIIHHITHHITTIIT IITIITIITHTHHTHTHHHH THITHIHIHIITIIIITIHI IIIHHIHITTIIIITTTITI THHIITTITHITTHIHTIHI IIITTIHIIHIIIHIITIII IIIITHIHTTITIIHIIITI HIIIIHIIHHIIHIIHHIII TTTITIHITIIIHTIIHTTH IHIHIIHIHTTIIIIIHHTT THHIHHTIIITITTITIITI ITIHHIIHTIITHIHTTIIH HTIIHIIIHTIIIHHHHHII ...```
view   save

correct output
```12 84 0 37 96 0 69 0 120 181 55 32 40 0 38 196 230 61 13 6 ...```
view   save

user output
```12 84 0 37 96 0 69 0 120 181 55 32 40 0 38 196 230 61 13 6 ...```
view   save

### Test 2

Verdict: ACCEPTED

input
```100 TIIHHITTITITIHTHIIIITHIHHIIHTI...```
view   save

correct output
```606723862 621369559 655243897 550750615 717769300 665089504 642274956 551961964 664708056 777169105 656828941 688142963 713223918 601227597 653912421 553449705 593989615 583046208 572753212 501740301 ...```
view   save

user output
```606723862 621369559 655243897 550750615 717769300 665089504 642274956 551961964 664708056 777169105 656828941 688142963 713223918 601227597 653912421 553449705 593989615 583046208 572753212 501740301 ...```
view   save

### Test 3

Verdict: ACCEPTED

input
```10 TTHTHHTIIIIIITHIIHIITITTITTIIH...```
view   save

correct output
```64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 65592769713081781 64464967247944127 65438455195590511 64413241735660784 64966612866364956```
view   save

user output
```64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 65592769713081781 64464967247944127 65438455195590511 64413241735660784 64966612866364956```
view   save

### Test 4

Verdict: ACCEPTED

input
```3 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH...```
view   save

correct output
```781234375000000000 4999750003 0```
view   save

user output
```781234375000000000 4999750003 0```
view   save