Code Submission Evaluation System Login

HIIT Open 2018

Start:2018-05-26 11:00:00
End:2018-05-26 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2018 - Results
History
2018-05-26 13:24:41
Task:HIIT Generation
Sender:DualCore
Submission time:2018-05-26 13:24:41
Language:C++
Status:READY
Result:TIME LIMIT EXCEEDED

Test results

testverdicttime (s)
#1TIME LIMIT EXCEEDED-- / 1.00details
#2TIME LIMIT EXCEEDED-- / 1.00details
#3TIME LIMIT EXCEEDED-- / 1.00details
#4ACCEPTED0.01 / 1.00details

Code

#include <iostream>
#include <string>

void replace(std::string& str, char c)
{
  std::string ret;
  ret.reserve(1000000);
  for (unsigned int i = 0; i < str.length(); ++i)
    {
      if (str[i] == c)
	ret = ret + "HIIT";
      else
	ret.push_back(str[i]);
    }
  str = ret;
}

int main()
{
  std::string first_line;
  int n;
  std::getline(std::cin, first_line);
  n = std::stoi(first_line);
  std::string HIIT = "HIIT";
  for (int i = 0; i < n; ++i)
    {
      std::string line;
      std::getline(std::cin, line);
      char c = line[0];
      replace(HIIT, c);
    }
  std::cout << HIIT;
}

Test details

Test 1

Verdict: TIME LIMIT EXCEEDED

input
17
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
view   save

correct output
HHHHHHHHHHHHHHHHHHIITHIITTHHII...
view   save

user output
(no output)
view   save

Test 2

Verdict: TIME LIMIT EXCEEDED

input
333332
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
...
view   save

correct output
HIITIITIITIITIITIITIITIITIITII...
view   save

user output
(no output)
view   save

Test 3

Verdict: TIME LIMIT EXCEEDED

input
24
H
T
H
T
H
T
H
T
H
T
H
T
H
T
H
T
H
T
H
...
view   save

correct output
HIIHIITIIHIIHIITIIHIITIIHIIHII...
view   save

user output
(no output)
view   save

Test 4

Verdict: ACCEPTED

input
0
view   save

correct output
HIIT
view   save

user output
HIIT
view   save