| Task: | Ositus |
| Sender: | valk |
| Submission time: | 2021-10-15 01:33:52 +0300 |
| Language: | Java |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.12 s | 1, 2, 3 | details |
| #2 | WRONG ANSWER | 0.24 s | 1, 2, 3 | details |
| #3 | WRONG ANSWER | 0.19 s | 1, 2, 3 | details |
| #4 | WRONG ANSWER | 0.19 s | 1, 2, 3 | details |
| #5 | WRONG ANSWER | 0.21 s | 2, 3 | details |
| #6 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #7 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;
public class Main {
public static void main(String[] args) { //remove comments before upload
Scanner input = new Scanner(System.in);
String msg = input.nextLine(); //msg
ArrayList<String> solutions = new ArrayList<>();
ArrayList<String> process = new ArrayList<>();
boolean done = false;
//System.out.println("processing msg: " + msg);
process.add(msg);
if(msg.length() == 1) {
solutions.add(msg);
done = true;
}
while(!done) {
done = true;
ArrayList<String> newprocess = new ArrayList<>();
for(String proc : process) {
//System.out.println("processing possible: " + proc);
for(int b = 0; b < proc.length()-1 ; b++) {
//System.out.println("b " + proc.substring(b, b+1) + " b1 " + proc.substring(b+1, b+2));
if(!proc.substring(b, b+1).contains(",") && !proc.substring(b+1, b+2).contains(",")) {
String ns = proc.substring(0, b+1) + "," + proc.substring(b+1, proc.length());
//System.out.println("trying: " + ns);
if(!process.contains(ns) && !solutions.contains(ns)) {
boolean valid = true;
for(String s : ns.split(",")) {
ArrayList<String> letters = new ArrayList<>();
for(int l = 0; l < s.length() ; l++) {
String letter = s.substring(l,l+1);
if(!letters.contains(letter)) {
letters.add(letter);
}else {
valid = false;
}
}
}
if(valid) {
//System.out.println("valid: " + ns);
newprocess.add(ns);
solutions.add(ns);
done = false;
} else {
newprocess.add(ns); //way more inefficient, goes through everything until its all , but fixes some issues
//System.out.println("invalid: " + ns);
}
}
}
}
}
process = newprocess;
}
int extra = solutions.size()%10000007;
//System.out.println("done, solution count: " + solutions.size());
System.out.println(extra);
input.close();
}
}
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| a |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| abcdefghij |
| correct output |
|---|
| 512 |
| user output |
|---|
| 511 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| abcabaacbc |
| correct output |
|---|
| 120 |
| user output |
|---|
| 0 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| aaxxxxxxaa |
| correct output |
|---|
| 4 |
| user output |
|---|
| 0 |
Test 5
Group: 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| mfyzvoxmppoxcvktmcjkryyocfweub... |
| correct output |
|---|
| 643221148 |
| user output |
|---|
| 0 |
Test 6
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| weinscqmmpgbrlboocvtbptgbahmwv... |
| correct output |
|---|
| 831644159 |
| user output |
|---|
| (empty) |
Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
| correct output |
|---|
| 816016015 |
| user output |
|---|
| (empty) |
