Code Submission Evaluation System Login

CSES - HIIT Open 2016

HIIT Open 2016

Contest start:2016-05-28 11:00:00
Contest end:2016-05-28 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2016-05-28 16:01:26
2016-05-28 15:59:55
2016-05-28 14:35:00
Task:HIIT remains
Sender:zah
Submission time:2016-05-28 15:59:55
Status:READY
Result:WRONG ANSWER

Show test data

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:9: warning: variable 'iit' set but not used [-Wunused-but-set-variable]
     int iit;
         ^
input/code.cpp:20:9: warning: unused variable 'tmp' [-Wunused-variable]
     int 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);
    int t;
    string data;

    int vastaus;
    int iit;

    int 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;
        int n=data.size();
        for (int j=0; j<n; ++j){
            if (m[data[j]] != 0) letters.push_back(m[data[j]]);
        }

        iit=0;
        int 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";
    }



}