Code Submission Evaluation System Login

CSES - HIIT Open 2018

HIIT Open 2018

Contest start:2018-05-26 11:00:00
Contest end:2018-05-26 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2018-05-26 15:47:21
2018-05-26 13:14:38
2018-05-26 13:14:09
2018-05-26 11:50:31
Task:Data Packet Routing
Sender:El Numero Uno
Submission time:2018-05-26 15:47:21
Status:READY
Result:TIME LIMIT EXCEEDED

Show test data

Code

import java.util.*;

public class d {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s;
		
		int c = Integer.parseInt(in.nextLine());
		for (int i = 0; i < c; i++) {
			Map<String, Integer> d = new HashMap<>();
			int k = Integer.parseInt(in.nextLine().split(" ")[1]);
			for (int j = 0; j < k; j++) {
				s = in.nextLine();
				if (d.containsKey(s)) d.put(s, d.get(s) + 1);
				else d.put(s, 1);
			}
			System.out.println(d.values().stream().max(Comparator.naturalOrder()).get());
		}
		
	
		
		
	}
	
}