| Task: | HIIT Generation |
| Sender: | DualCore |
| Submission time: | 2018-05-26 13:24:41 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | TIME LIMIT EXCEEDED | -- | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
| #3 | TIME LIMIT EXCEEDED | -- | details |
| #4 | ACCEPTED | 0.01 s | details |
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 ... |
| correct output |
|---|
| HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
| user output |
|---|
| (empty) |
Test 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 333332 H H H H ... |
| correct output |
|---|
| HIITIITIITIITIITIITIITIITIITII... |
| user output |
|---|
| (empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 24 H T H T ... |
| correct output |
|---|
| HIIHIITIIHIIHIITIIHIITIIHIIHII... |
| user output |
|---|
| (empty) |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 0 |
| correct output |
|---|
| HIIT |
| user output |
|---|
| HIIT |
