CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Tefyn virallinen maajoukkue
Submission time:2018-05-26 12:56:45 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#20.01 sdetails
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

int n; 
char m[1000];

string expand(string c, int i){
    if(i == n)
        return c;
    
    if(c[0] == m[i]){
        return expand("H", i+1)+expand("I", i+1)+expand("I", i+1)+expand("T", i+1);
    }
    else
        return expand(c, i+1);
}

int main(){
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> m[i];
    }
    cout << expand("H", 0)+expand("I", 0)+expand("I", 0)+expand("T", 0) << endl;
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
17
I
I
I
I
...

correct output
HHHHHHHHHHHHHHHHHHIITHIITTHHII...

user output
HHHHHHHHHHHHHHHHHHIITHIITTHHII...

Test 2

Verdict:

input
333332
H
H
H
H
...

correct output
HIITIITIITIITIITIITIITIITIITII...

user output
(empty)

Test 3

Verdict: ACCEPTED

input
24
H
T
H
T
...

correct output
HIIHIITIIHIIHIITIIHIITIIHIIHII...

user output
HIIHIITIIHIIHIITIIHIITIIHIIHII...

Test 4

Verdict: ACCEPTED

input
0

correct output
HIIT

user output
HIIT