Rezultati

Up. imeNalogaJezikRezultatČas oddaje
pridnerozice-2017 Pasavci Java 0/100Napaka med izvajanjem / ob izhodu (RTE) 11. maj '17 @ 17:35

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 33,137 MiB 0,000 s OK
#2 5/5 30,531 MiB 0,000 s OK
#3 5/5 54,070 MiB 0,082 s OK
#4 0/5 154,801 MiB 0,385 s Prekoračen spomin
#5 0/5 166,152 MiB 0,390 s Prekoračen spomin
#6 0/5 157,781 MiB 0,624 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3332)
	at java.lang.String.concat(String.java:2032)
	at Pasavci.main(Pasavci.java:19)
#7 0/5 164,844 MiB 0,503 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3332)
	at java.lang.String.concat(String.java:2032)
	at Pasavci.main(Pasavci.java:19)
#8 0/5 162,859 MiB 0,389 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3332)
	at java.lang.String.concat(String.java:2032)
	at Pasavci.main(Pasavci.java:19)
#9 0/6 160,449 MiB 0,267 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3332)
	at java.lang.String.concat(String.java:2032)
	at Pasavci.main(Pasavci.java:19)
#10 0/6 141,547 MiB 0,000 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3332)
	at java.lang.String.concat(String.java:2032)
	at Pasavci.main(Pasavci.java:19)
#11 6/6 34,605 MiB 0,000 s OK
#12 6/6 39,719 MiB 0,000 s OK
#13 6/6 35,832 MiB 0,000 s OK
#14 6/6 34,719 MiB 0,000 s OK
#15 6/6 73,703 MiB 0,000 s OK
#16 6/6 36,922 MiB 0,000 s OK
#17 6/6 39,770 MiB 0,000 s OK
#18 6/6 52,891 MiB 0,088 s OK

Ocenjevani program (Pasavci.java):
import java.util.*;
import java.lang.*;

public class Pasavci{

	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String p = sc.next();
		String s1 = sc.next();
		String s2 = sc.next();
		int m = sc.nextInt();
		String[] beseda = new String[m+2];
		beseda[0] = s1;
		beseda[1] = s2;

		for(int i = 0; i < m; i++){
			int st1 = sc.nextInt();
			int st2 = sc.nextInt();
			beseda[i+2] = beseda[st1-1].concat(beseda[st2-1]);
		}
		int stevec = 0;
		for(int i = 0; i <= beseda[m+1].length() - p.length(); i++){
			if(beseda[m+1].substring(i, i+p.length()).equals(p)) stevec++;
		}
		System.out.print(stevec);
		
	}

}