Task: | HIIT Generation |
Sender: | TreamDeam |
Submission time: | 2018-05-26 13:21:37 +0300 |
Language: | Java |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.54 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | ACCEPTED | 0.38 s | details |
Code
import java.util.Scanner; public class H { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.nextLine(); String h = "H"; String i = "I"; String t = "T"; for (int j = 0; j < n; j++) { String input = in.nextLine(); if (input.equals("H")) { h = h.replaceAll("H", "HIIT"); i = i.replaceAll("H", h); t = t.replaceAll("H", h); } else if (input.equals("I")) { i = i.replaceAll("I", "HIIT"); h = h.replaceAll("I", i); t = t.replaceAll("I", i); } else if (input.equals("T")) { t = t.replaceAll("T", "HIIT"); h = h.replaceAll("T", t); i = i.replaceAll("T", t); } } System.out.println(h + i + i + t); in.close(); } }
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: 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 |