CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Puhi~
Submission time:2018-05-26 11:32:54 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.03 sdetails
#2--details
#3ACCEPTED0.02 sdetails
#4ACCEPTED0.01 sdetails

Code

#include <iostream>
#include <stdio.h>

using namespace std;

char x[1000000];
int n;

void r(char a, int y) {

    for (;y < n; y++) {
        if (x[y] == a) {
            r('H', y+1);
            r('I', y+1);
            r('I', y+1);
            r('T', y+1);
            return;
        }
    }

    putchar_unlocked(a);
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    
    r('H', 0);
    r('I', 0);
    r('I', 0);
    r('T', 0);
    putchar_unlocked('\n');
}

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