Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 34,750 MiB 0,000 s OK
#2 5/5 44,453 MiB 0,000 s OK
#3 5/5 78,105 MiB 0,000 s OK
#4 0/5 155,160 MiB 1,911 s Prekoračen spomin
#5 0/5 160,797 MiB 0,520 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.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
	at java.lang.StringBuilder.append(StringBuilder.java:136)
	at neki.main(neki.java:15)
#6 0/5 164,547 MiB 0,494 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOfRange(Arrays.java:3664)
	at java.lang.String.<init>(String.java:207)
	at java.lang.StringBuilder.toString(StringBuilder.java:407)
	at neki.main(neki.java:15)
#7 0/5 161,820 MiB 0,666 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.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
	at java.lang.StringBuilder.append(StringBuilder.java:136)
	at neki.main(neki.java:15)
#8 0/5 162,125 MiB 0,458 s Prekoračen spomin
Stderr:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOfRange(Arrays.java:3664)
	at java.lang.String.<init>(String.java:207)
	at java.lang.StringBuilder.toString(StringBuilder.java:407)
	at neki.main(neki.java:15)
#9 0/6 162,590 MiB 0,493 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.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
	at java.lang.StringBuilder.append(StringBuilder.java:136)
	at neki.main(neki.java:15)
#10 0/6 147,258 MiB 0,070 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.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
	at java.lang.StringBuilder.append(StringBuilder.java:136)
	at neki.main(neki.java:15)
#11 6/6 35,719 MiB 0,000 s OK
#12 6/6 37,668 MiB 0,000 s OK
#13 6/6 36,813 MiB 0,000 s OK
#14 6/6 39,660 MiB 0,000 s OK
#15 0/6 79,043 MiB 1,910 s Prekoračen čas
#16 6/6 37,406 MiB 0,000 s OK
#17 6/6 36,453 MiB 0,000 s OK
#18 6/6 53,770 MiB 0,139 s OK

Ocenjevani program (neki.java):
import java.util.*;
public class neki {
	public static void main(String[] args){
		Scanner vnos = new Scanner(System.in);
		String prviTrije[] = new String[3];
		for(int i = 0; i < 3; i++)prviTrije[i] = vnos.nextLine();
		int m;
		m = vnos.nextInt();
		String nizi[] = new String[m+2];
		for(int i = 0; i < 2; i++)nizi[i]=prviTrije[i + 1];
		for(int i = 2; i < m+2;i++){
			int x,y;
			x = vnos.nextInt();
			y = vnos.nextInt();
			nizi[i] = nizi[x - 1] + nizi[y - 1];
		}
		vnos.close();
		
		int count = 0;
		int l = nizi[m+1].length();
		for(int i =0; i < l; i++){
			int find = nizi[m+1].substring(i, l).indexOf(prviTrije[0]);
			i += find;
			if(find >=0){
				count++;
			}else{
				break;
			}
		}
		System.out.println(((long) count)%(1000000007));
	}
}