| Task: | HIIT Generation |
| Sender: | Lucinda |
| Submission time: | 2018-05-26 13:08:32 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.10 s | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
| #3 | ACCEPTED | 0.08 s | details |
| #4 | ACCEPTED | 0.01 s | details |
Code
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <vector>
using namespace std;
struct L {
L(char c) {
this->c = c;
}
char c;
L *next = nullptr;
};
int main() {
L *h = new L('H');
L *i1 = new L('I');
h->next = i1;
L *i2 = new L('I');
i1->next = i2;
L *t = new L('T');
i2->next = t;
L *begin = h;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
char c;
cin >> c;
L *l = begin;
while (l) {
if (l->c == c) {
l->c = 'H';
L *next = l->next;
L *i1 = new L('I');
l->next = i1;
L *i2 = new L('I');
i1->next = i2;
L *t = new L('T');
i2->next = t;
t->next = next;
l = t;
}
l = l->next;
}
}
L *l = begin;
while (l) {
cout << l->c;
l = l->next;
}
cout << endl;
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 17 I I I I ... |
| correct output |
|---|
| HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
| user output |
|---|
| HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
Test 2
Verdict: TIME LIMIT EXCEEDED
| 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 |
