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 14:13:27
2018-05-26 14:11:50
2018-05-26 12:19:05
2018-05-26 12:18:13
2018-05-26 12:17:00
2018-05-26 11:57:51
Task:HIIT Generation
Sender:DROP TABLE
Submission time:2018-05-26 14:13:27
Language:Java
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.23 / 1.00details

Code

import java.util.Scanner;

public class Main {
	private static final String HIIT = "HIIT";

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		StringBuilder r = new StringBuilder();
		int limit = scanner.nextInt();
		r.append(HIIT);
		for (int i = 0; i < limit; i++) {
			char c = scanner.next().charAt(0);
			for(int j = 0; j < r.length(); j++){
				if(r.charAt(j) == c) {
					r.deleteCharAt(j);
					r.insert(j, HIIT);
					//System.out.println("INSERTED");
					//System.out.println(r.toString());
					j += 3;
				}
			}
		}
		scanner.close();
		System.out.println(r.toString());
		/*LinkedList<Character> chars = new LinkedList<>();
		chars.add('H'); chars.add('I'); chars.add('I'); chars.add('T');
		String HIIT = HIIT2;
		Scanner scanner = new Scanner(System.in);
		
		Iterator<Character> it = chars.iterator();
		for (int i = 0; i < limit; i++) {
			Character letter = scanner.next().charAt(0);
			int index = 0;
			while(it.hasNext()){
				Character c = it.next();
				if(c.equals(letter)){
					chars.add(index, "")
				}
			}
		}
		
		for (int i = 0; i < limit; i++) {
			HIIT = HIIT.replaceAll(scanner.nextLine(), HIIT2);
		}
		System.out.println(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