CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Robotiimi
Submission time:2018-05-26 15:58:54 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.01 sdetails
#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');
            r.insert(it, 'I');
            r.insert(it, 'I');
            ++it;            ++it;            ++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
HHHHHHHHHHHHHHHHHHHHHIITITITHI...

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
HIIHIITIIHIIHIITIIHIIHIITIIHII...

Test 4

Verdict: ACCEPTED

input
0

correct output
HIIT

user output
HIIT