CSES - HIIT Open 2018 - Results
Submission details
Task:HIIT Generation
Sender:Lucinda
Submission time:2018-05-26 13:08:32 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.10 sdetails
#2--details
#3ACCEPTED0.08 sdetails
#4ACCEPTED0.01 sdetails

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:

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