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

Code

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

using namespace std;

int main()
{
  string base = "HIIT";
  int n = 0, l = 4;
  char c;
  cin >> n;

  for (int i=0; i<n; i++)
    {
      cin >> c;
	
      for (int j=0; j<l; j++)
      if (base[j] == c)
	{
	base.replace(j,1,"HIIT");
	l = base.length();
	j = j+3;
	}
    }

  cout << base;
  return 0;
}

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
(empty)

Test 4

Verdict: ACCEPTED

input
0

correct output
HIIT

user output
HIIT