[Timus] 1563 Bayan

Problem statement is here: http://acm.timus.ru/problem.aspx?space=1&num=1563

Straightforward problem. You should use map for faster processing.

public void solve(int testNumber, InputReader in, OutputWriter out) {
        Map<String, Boolean> visitedStores = new HashMap<>();

        int n = in.nextInt();

        int numStoresSeenBefore = 0;

        for (int i = 0; i < n; i++) {
            String store = in.readLine();
            if (visitedStores.containsKey(store)) {
            } else {
                visitedStores.put(store, true);




Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.