| Task: | Tulkki |
| Sender: | DataN29 |
| Submission time: | 2025-10-29 12:30:09 +0200 |
| Language: | Java |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| #2 | RUNTIME ERROR | 0 |
| #3 | RUNTIME ERROR | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | RUNTIME ERROR | 0.13 s | 1, 2, 3 | details |
| #2 | RUNTIME ERROR | 0.13 s | 1, 2, 3 | details |
| #3 | RUNTIME ERROR | 0.13 s | 1, 2, 3 | details |
| #4 | RUNTIME ERROR | 0.14 s | 1, 2, 3 | details |
| #5 | RUNTIME ERROR | 0.19 s | 1, 2, 3 | details |
| #6 | RUNTIME ERROR | 0.19 s | 1, 2, 3 | details |
| #7 | RUNTIME ERROR | 0.13 s | 2, 3 | details |
| #8 | RUNTIME ERROR | 0.13 s | 2, 3 | details |
| #9 | RUNTIME ERROR | 0.13 s | 2, 3 | details |
| #10 | RUNTIME ERROR | 0.14 s | 2, 3 | details |
| #11 | RUNTIME ERROR | 0.13 s | 2, 3 | details |
| #12 | RUNTIME ERROR | 0.14 s | 2, 3 | details |
| #13 | RUNTIME ERROR | 0.13 s | 3 | details |
| #14 | RUNTIME ERROR | 0.13 s | 3 | details |
| #15 | RUNTIME ERROR | 0.13 s | 3 | details |
| #16 | RUNTIME ERROR | 0.13 s | 3 | details |
| #17 | RUNTIME ERROR | 0.14 s | 3 | details |
| #18 | RUNTIME ERROR | 0.15 s | 3 | details |
Code
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Thulk tulkki=new Thulk();
tulkki.activate();
}
}
final class Thulk {
public Thulk(){
int a=0;
}
public void activate(){
Repeat repeat=new Repeat();
try (Scanner scan = new Scanner(System.in)) {
while (true){
String cod=scan.next();
ArrayList<String> exec=new ArrayList<>();
String[] temp=cod.split(" ");
int temp2=0;
ArrayList<String> temp3=new ArrayList<>();
String temp4="";
int temp5=0;
boolean temp6=false;
for (int i=0;i<temp.length;i++){
exec.add(temp[i]);
}
if (exec.get(0).equals("#")){
exec.clear();
} else {
while (exec.size()>1){
if (repeat.repeat.variabIndex.indexOf(exec.get(1))==-1&&!exec.get(1).equals(")")){
repeat.repeat.variabIndex.add(exec.get(1));
repeat.repeat.variab.add(0);
}
while (exec.get(0).equals(")")){
exec.remove(0);
}
if (exec.get(0).equals("CLEAR")){
repeat.repeat.variab.set(repeat.repeat.variabIndex.indexOf(exec.get(1)),0);
} else if (exec.get(0).equals("INCREASE")){
repeat.repeat.variab.set(repeat.repeat.variabIndex.indexOf(exec.get(1)),repeat.repeat.variab.get(repeat.repeat.variabIndex.indexOf(exec.get(1)))+1);
} else if (exec.get(0).equals("PRINT")){
System.out.println(repeat.repeat.variab.get(repeat.repeat.variabIndex.indexOf(exec.get(1))));
} else if (exec.get(0).equals("REPEAT")){
temp5=0;
temp6=false;
for (int k=0;k<exec.size();k++){
if (exec.get(k).equals("(")){
temp5+=1;
temp6=true;
} else if (exec.get(k).equals(")")){
temp5-=1;
}
if (temp5==0&&temp6){
temp5=k;
break;
}
}
for (int j=4; j<temp5+1;j++){
temp3.add(exec.get(j));
}
temp4=exec.get(1);
exec.remove(0);
exec.remove(0);
exec.remove(0);
exec.remove(0);
repeat.execute(repeat.repeat.variab.get(repeat.repeat.variabIndex.indexOf(temp4)), temp3,false);
temp2=exec.indexOf(")");
for (int k=0;k<temp2;k++){
exec.remove(0);
}
}
try{
if (exec.get(0).equals("REPEAT")||exec.get(0).equals(")")){
exec.remove(0);
} else {
exec.remove(0);
exec.remove(0);
}
}catch (IndexOutOfBoundsException e){
;
}
}
}
}
}
}
}
final class Repeat {
public Recurepeat repeat=new Recurepeat();
private ArrayList<String> save=new ArrayList<>();
public Repeat(){
int a=1;
}
public void execute(int rebst,ArrayList<String> commands, boolean recurs){
save.clear();
for (int i=0;i<commands.size();i++){
this.save.add(commands.get(i));
}
int repeats=rebst;
ArrayList<String> temp3=new ArrayList<>();
String temp4="";
int temp5=0;
boolean temp6=false;
while (repeats>0){
commands.clear();
for (int i=0;i<save.size();i++){
commands.add(save.get(i));
}
while (commands.size()>1){
if (repeat.variabIndex.indexOf(commands.get(1))==-1&&!commands.get(1).equals(")")){
repeat.variabIndex.add(commands.get(1));
repeat.variab.add(0);
}
if (commands.get(0).equals("CLEAR")){
repeat.variab.set(repeat.variabIndex.indexOf(commands.get(1)),0);
} else if (commands.get(0).equals("INCREASE")){
repeat.variab.set(repeat.variabIndex.indexOf(commands.get(1)),repeat.variab.get(repeat.variabIndex.indexOf(commands.get(1)))+1);
} else if (commands.get(0).equals("PRINT")){
System.out.println(repeat.variab.get(repeat.variabIndex.indexOf(commands.get(1))));
} else if (commands.get(0).equals("REPEAT")){
temp5=0;
temp6=false;
for (int k=0;k<commands.size();k++){
if (commands.get(k).equals("(")){
temp5+=1;
temp6=true;
} else if (commands.get(k).equals(")")){
temp5-=1;
}
if (temp5==0&&temp6){
temp5=k;
break;
}
}
for (int j=4; j<temp5+1;j++){
temp3.add(commands.get(j));
}
temp4=commands.get(1);
commands.remove(0);
commands.remove(0);
commands.remove(0);
commands.remove(0);
repeat.execute(repeat.variab.get(repeat.variabIndex.indexOf(temp4)), temp3,false);
}
try{
if (commands.get(0).equals("REPEAT")||commands.get(0).equals(")")){
commands.remove(0);
} else {
commands.remove(0);
commands.remove(0);
}
}catch (IndexOutOfBoundsException e){
;
}
}
repeats-=1;
}
}
}
final class Recurepeat {
public ArrayList<Integer> variab=new ArrayList<>();
public ArrayList<String> variabIndex=new ArrayList<>();
private ArrayList<String> save=new ArrayList<>();;
public Recurepeat(){
int a=1;
}
public void execute(int rebst,ArrayList<String> commands, boolean recurs){
save.clear();
for (int i=0;i<commands.size();i++){
this.save.add(commands.get(i));
}
int repeats=rebst;
Repeat repeat=new Repeat();
ArrayList<String> temp3=new ArrayList<>();
String temp4="";
int temp5=0;
boolean temp6=false;
while (repeats>0){
commands.clear();
for (int i=0;i<save.size();i++){
commands.add(save.get(i));
}
while (commands.size()>1){
if (variabIndex.indexOf(commands.get(1))==-1&&!commands.get(1).equals(")")){
variabIndex.add(commands.get(1));
variab.add(0);
}
if (commands.get(0).equals("CLEAR")){
variab.set(variabIndex.indexOf(commands.get(1)),0);
} else if (commands.get(0).equals("INCREASE")){
variab.set(variabIndex.indexOf(commands.get(1)),variab.get(variabIndex.indexOf(commands.get(1)))+1);
System.out.println("debug");
} else if (commands.get(0).equals("PRINT")){
System.out.println(variab.get(variabIndex.indexOf(commands.get(1))));
} else if (commands.get(0).equals("REPEAT")){
temp5=0;
temp6=false;
for (int k=0;k<commands.size();k++){
if (commands.get(k).equals("(")){
temp5+=1;
temp6=true;
} else if (commands.get(k).equals(")")){
temp5-=1;
}
if (temp5==0&&temp6){
temp5=k;
break;
}
}
for (int j=4; j<temp5+1;j++){
temp3.add(commands.get(j));
}
temp4=commands.get(1);
commands.remove(0);
commands.remove(0);
commands.remove(0);
commands.remove(0);
repeat.execute(variab.get(variabIndex.indexOf(temp4)), temp3,false);
}
try{
if (commands.get(0).equals("REPEAT")||commands.get(0).equals(")")){
commands.remove(0);
} else {
commands.remove(0);
commands.remove(0);
}
}catch (IndexOutOfBoundsException e){
;
}
}
repeats-=1;
}
}
}
Test details
Test 1 (public)
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| PRINT X INCREASE X PRINT X INCREASE X PRINT X ... |
| correct output |
|---|
| 0 1 2 0 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 2 (public)
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE X # aybabtu PRINT X INCREASE # test ... |
| correct output |
|---|
| 1 3 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 3 (public)
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| # Create number 3 INCREASE X INCREASE X INCREASE X ... |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 4 (public)
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A PRINT A INCREASE B PRINT B INCREASE C ... |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 5 (public)
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE X INCREASE X INCREASE X INCREASE X INCREASE X ... |
| correct output |
|---|
| 999 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 6 (public)
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| PRINT X PRINT X PRINT X PRINT X PRINT X ... |
| 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.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 7 (public)
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 5 5 5 5 5 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 8 (public)
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 0 0 0 0 0 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 9 (public)
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 6 7 8 9 10 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 10 (public)
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 5 5 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 11 (public)
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 20 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 12 (public)
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE B INCREASE B ... |
| correct output |
|---|
| 42 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 13 (public)
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 14 (public)
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| # Create number 3 INCREASE A INCREASE A INCREASE... |
| correct output |
|---|
| 12 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 15 (public)
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE X INCREASE X INCREASE X INCREASE X INCREASE X ... |
| correct output |
|---|
| 531441 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 16 (public)
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A ... |
| correct output |
|---|
| 1337 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 17 (public)
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| INCREASE A INCREASE A REPEAT A TIMES ( REPEAT A TIMES ( ... |
| correct output |
|---|
| 1 2 1 2 1 1 3 4 3 4 3 4 3 4 3 ... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
Test 18 (public)
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| # Efficient algorithm for find... |
| correct output |
|---|
| 2 3 5 7 11 13 17 19 23 29 31 3... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Thulk.activate(Main.java:20) at Main.main(Main.java:7)
