| Task: | Alphabet Accumulation |
| Sender: | madwarge |
| Submission time: | 2018-09-20 17:46:53 +0300 |
| Language: | Java |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.21 s | details |
| #2 | ACCEPTED | 0.23 s | details |
| #3 | ACCEPTED | 0.24 s | details |
| #4 | TIME LIMIT EXCEEDED | -- | details |
| #5 | TIME LIMIT EXCEEDED | -- | details |
| #6 | TIME LIMIT EXCEEDED | -- | details |
| #7 | RUNTIME ERROR | 0.40 s | details |
| #8 | RUNTIME ERROR | 1.67 s | details |
| #9 | RUNTIME ERROR | 1.69 s | details |
| #10 | TIME LIMIT EXCEEDED | -- | details |
Code
//package alphabetaccumulation;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class AlphabetAccumulation {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int m = s.nextInt();
s.nextLine();
String str = s.nextLine();
List<String> lista = new ArrayList<>();
for (int i = 0; i < m; i++) {
lista.add(s.nextLine());
}
int tieto = 0;
for (int i = 1; i <= n; i++) {
int[] t = new int['z'];
for (int p = 0; p < i; p++) {
t[str.charAt(p)]++;
}
int summa = 0;
for (String string : lista) {
int[] t2 = new int['z'];
for (int j = 0; j < string.length(); j++) {
t2[string.charAt(j)]++;
if(t2[string.charAt(j)] > t[string.charAt(j)]) {
summa--;
break;
}
}
summa++;
}
System.out.println(summa);
}
}
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 3 3 aab aa ba bb |
| correct output |
|---|
| 0 1 2 |
| user output |
|---|
| 0 1 2 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 100 10 facdeebdaeffeadfdccgecbbegfdff... |
| correct output |
|---|
| 0 0 0 0 0 0 2 2 2 2 2 2 2 2 2 ... |
| user output |
|---|
| 0 0 0 0 0 ... Truncated |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 100 50 gggggfgggfggeggeggafgfffgggfgg... |
| correct output |
|---|
| 0 0 0 0 0 3 3 3 3 4 4 4 29 29 ... |
| user output |
|---|
| 0 0 0 0 0 ... Truncated |
Test 4
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 yzxyzzyywyyzzyzwwzwytyzzyxxxyy... |
| correct output |
|---|
| 17 18 18 18 18 18 18 18 2197 2... |
| user output |
|---|
| (empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz... |
| correct output |
|---|
| 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ... |
| user output |
|---|
| (empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 20 ccacccbaccccacacacacaaacaccccc... |
| correct output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 20 rypyjiljrkjrhsbohtbvacxnfyucvi... |
| correct output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 122 at AlphabetAccum...
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 32258 ztixcicqghqttowabnxvulwngxzpsm... |
| correct output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 122 at AlphabetAccum...
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 100000 32258 zzzyzzzzzzzzzzzyzzzzzzzzzzzyzz... |
| correct output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 122 at AlphabetAccum...
Test 10
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 30488 rsrlsoassssrrsssrrrssrssrsrrss... |
| correct output |
|---|
| 1 2 2 2 2 4 5 5 5 5 5 5 5 5 5 ... |
| user output |
|---|
| (empty) |
