CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Wave of Technology
Submission time:2018-05-26 11:54:45 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2--details
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;


ll n;
vector<char> cc;

void recurse(char c, int lvl=0) {
  if (lvl == n) {
    cout << c;
    return;
  }
  
  if (cc[lvl] == c) {
    recurse('H', lvl+1);
    recurse('I', lvl+1);
    recurse('I', lvl+1);
    recurse('T', lvl+1);
  }  else {
    recurse(c, lvl+1);
  }
  
}

int main() {

  cin.tie(NULL);
  std::ios::sync_with_stdio(false);

  cin >> n;

  cc.resize(n);
  for (int i=0; i<n; i++) {
    cin >> cc[i];
  }

  recurse('H');
  recurse('I');
  recurse('I');
  recurse('T');
    
  cout << endl;
}

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