CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Robotiimi
Submission time:2018-05-26 15:59:54
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1--details
#2--details
#30.01 sdetails
#4ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <list>

using namespace std;


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

list <char> r;
r.push_back('H');
r.push_back('I');
r.push_back('I');
r.push_back('T');

int n;
cin >> n;
char a;


for (int i=0; i<n; i++) {
    cin >> a;
     
    for (list<char>::iterator it=r.begin(); it!=r.end(); ++it) {
        if (*it == a) {
            *it = 'T';
            r.insert(it, 'H');++it;
            r.insert(it, 'I');++it;
            r.insert(it, 'I');
            ++it;                  
        }
    }
}
    for (list<char>::iterator it=r.begin(); it!=r.end(); ++it) { 
        cout << *it;
}
}

Test details

Test 1

Verdict:

input
17
I
I
I
I
...

correct output
HHHHHHHHHHHHHHHHHHIITHIITTHHII...

user output
(empty)

Test 2

Verdict:

input
333332
H
H
H
H
...

correct output
HIITIITIITIITIITIITIITIITIITII...

user output
(empty)

Test 3

Verdict:

input
24
H
T
H
T
...

correct output
HIIHIITIIHIIHIITIIHIITIIHIIHII...

user output
IHHTIIIHIHTIIIIIHHTIIIIIHHTIII...

Test 4

Verdict: ACCEPTED

input
0

correct output
HIIT

user output
HIIT