CSES - HIIT Open 2016 - Results
Submission details
Task:HIIT remains
Sender:zah
Submission time:2016-05-28 16:01:26 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.05 sdetails
#20.06 sdetails
#30.06 sdetails
#40.05 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:40:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j=0; j<letters.size(); j++) {
                                      ^
input/code.cpp:18:10: warning: variable 'iit' set but not used [-Wunused-but-set-variable]
     long iit;
          ^
input/code.cpp:20:10: warning: unused variable 'tmp' [-Wunused-variable]
     long tmp;
          ^

Code

#include <iostream>
#include <map>
#include <vector>

using namespace std;

//ios_base::sync_with_stdio(0);
//cin.tie(0);


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long t;
    string data;

    long vastaus;
    long iit;

    long tmp;
    cin >> t;
    map<char,int> m;
    m['H']=1; m['I']=2; m['T']=3;    
    
    for (int i=0;i<t;i++) {
        vector<int> letters;
        vector<int> summa;
        vector<int> hoot;
        vector<int> teet;

        vastaus=0;
        cin >> data;
        long n=data.size();
        for (int j=0; j<n; ++j){
            if (m[data[j]] != 0) letters.push_back(m[data[j]]);
        }

        iit=0;
        long random=0, random2=0, r3=4, r4=0;
        for (int j=0; j<letters.size(); j++) {
            if (letters[j]==1) {hoot.push_back(j); r3=0;}
            else if (letters[j]==3) {teet.push_back(j); vastaus+=random; }
            else if (letters[j]==2) { random+=r4+random2;  r4+=random2;
                            if (r3==0) {
                                    r3=1;
                   
                                    random2+=1;
}
}
        //    summa.push_back(iit);   
        }


        /*for (int j=0; j<hoot.size(); j++) {
            for (int k=0; k<teet.size(); k++) {
                if (teet[k]>hoot[j]) {
                   tmp = summa[teet[k]] - summa[hoot[j]];
                   vastaus += (tmp*(tmp-1))/2;
                }
            }
        }*/
        cout << vastaus << "\n";
    }



}

Test details

Test 1

Verdict:

input
100
IIITIIIHITHTHIIITIII
HIHIIIIIIHIIITHIIIII
ITTIIIITIIIIIIITIIIT
IITHITITIHHIITTTIIII
...

correct output
12
84
0
37
96
...

user output
9
84
0
34
55
...

Test 2

Verdict:

input
100
TIIHHITTITITIHTHIIIITHIHHIIHTI...

correct output
606723862
621369559
655243897
550750615
717769300
...

user output
419835542
431597035
430813071
403571799
472811983
...

Test 3

Verdict:

input
10
TTHTHHTIIIIIITHIIHIITITTITTIIH...

correct output
64668032062669502
66159978956790306
65755072918424640
64408596558953628
65238005187079543
...

user output
43236818072945554
43487785922161453
44016680673446975
42789898047333830
43508374848140751
...

Test 4

Verdict:

input
3
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH...

correct output
781234375000000000
4999750003
0

user output
31249375000000
4999750003
0