Guys i am trying to solve the DAG Delete problem of December contest. My code runs perfectly fine on my computer and i have tested it for multiple cases. I have also made sure that everything is properly initialized and checked for corner cases too. Earlier i was using too much memory and even that is not the case now. Please tell me what are the not so common reasons where you people got Run Time Error or how should i proceed with debugging my code.
hi
i have tried to solve this package it’s working fine when i try it but when i upload the answer i get NZEC so plz someone help!
this is my code java application1;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int arr[][] = new int[100][2];
int x = sc.nextInt();
int y = sc.nextInt();
int ii = 0;
while ((x!=-1)&&(y!=-1)){
arr[ii][0] = x;
arr[ii][1] = y;
ii++;
x = sc.nextInt();
y = sc.nextInt();
}
for (int i = 0; i < ii; i++) {
x = arr[i][0];
y = arr[i][1];
if ((x == 1) || (y == 1)){
System.out.println(x + "+" + y + "=" + (x + y));
}
In languages which have exception handling like Java , Python etc we can use exception hadling using try - catch blocks. NZEC is a runtime error . It mostly occurs when negative array index is accesed or the program which we have written takes up more space than the allocated memory for our program to run.