CSES - Datatähti 2016 alku - Results
Submission details
Task:Osajono
Sender:Galax
Submission time:2015-09-29 21:23:03 +0300
Language:Java
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.17 s1details
#20.17 s1details
#30.16 s1details
#40.17 s1details
#50.17 s1details
#60.18 s2details
#70.17 s2details
#80.17 s2details
#90.18 s2details
#100.19 s2details
#110.19 s3details
#120.19 s3details
#130.18 s3details
#140.18 s3details
#150.19 s3details

Code

import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        IO io = new IO();
        String input = io.next();
        int counter = 0;
        ArrayList<Integer> amount = new ArrayList<>();
        ArrayList<Character> cha = new ArrayList<>();
        Character[] chars = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
        for (char c : chars) {
            cha.add(c);
        }
        for (char c : chars) {
            for (int i = 0; i < input.length(); i++) {
                if (input.charAt(i)==c) {
                    amount.set(cha.indexOf(c),amount.get(c)+1);
                }
            }
        }

        for (int i = 0; i < cha.size(); i++) {
            int a = 1;
            int b = 0;
            for (int j = 0; j < amount.get(i); i++) {
                b += a;
                a++;
            }
            counter+=b;
        }

        io.println(counter);
        io.close();
    }
}


/*
public class Main {

    public static void main(String[] args) {

        IO io = new IO();
        String input = io.next();
        int counter = 0;

        char[] chars = input.toCharArray();
        int l = chars.length;

        for(int first=0; first < l; first++) {
            for (int second = first+1; second < l; second++) {
                if (chars[first]==chars[second]) {
                    counter++;
                }
            }
        }
        io.println(counter+l);
        io.close();
    }
} */

Test details

Test 1

Group: 1

Verdict:

input
BBBAABBBAAAABBAAAABAABAABBBBBB...

correct output
2554

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 2

Group: 1

Verdict:

input
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL...

correct output
299

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 3

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA...

correct output
4314

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 4

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4231

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 5

Group: 1

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5050

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 81, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 6

Group: 2

Verdict:

input
BBABABBBABBAABBABBABAABAAABABA...

correct output
6253029

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 7

Group: 2

Verdict:

input
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG...

correct output
485173

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 8

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12427725

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 9

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12467549

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 10

Group: 2

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
12502500

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 81, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 11

Group: 3

Verdict:

input
BAAAAABABBABAABAABABABBBABBAAB...

correct output
2500051369

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 12

Group: 3

Verdict:

input
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR...

correct output
192407124

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 13

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998050400

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 14

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998850144

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 65, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)

Test 15

Group: 3

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5000050000

user output
(empty)

Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 81, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at Main.main(Main.java:18)