# Contaminated Milk (2015 December Bronze) Testcase 9 Failing

My java solution to Contaminated Milk 2015 December Bronze follows similiar methodology as default solution but still fails on 9th testcase.

The design of my solution is to:

1. organize the input by person, the index of the pmts array is p-1
2. find for each person, what milks they drank before they got sick (bad_milks)
3. update the bad_milks_common ArrayList with new bad milks that were discovered and remove milks that are not bad anymore
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
public static void main(String[] args) throws IOException {
PrintWriter pw = new PrintWriter(new FileOutputStream("badmilk.out"));

int N = Integer.parseInt(st.nextToken());
int M = Integer.parseInt(st.nextToken());
int D = Integer.parseInt(st.nextToken());
int S = Integer.parseInt(st.nextToken());

int[][][] pmts = new int[N][D][2];
int[] counters = new int[N];
for(int i = 0; i < D; i++) {
int p = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int t = Integer.parseInt(st.nextToken());
int[] pmt = new int[] {m, t};
pmts[p-1][counters[p-1]] = pmt;
counters[p-1]++;
}

int[] sts = new int[N];
for(int i = 0; i < S; i++) {
int p = Integer.parseInt(st.nextToken());
int t = Integer.parseInt(st.nextToken());
sts[p-1] = t;
}

for(int i = 0; i < sts.length; i++) {
if(sts[i]!=0) {
for (int j = 0; j < pmts[i].length; j++) {
if(pmts[i][j][1] < sts[i]) {
if(i==0) {
} else {
}
}
}
if(i!=0) {
for (int k = 0; k < bad_milks_common.size(); k++) {
}
}
for(int k = 0; k < bad_milks.size(); k++) {
}
}
}
}
}

int res = 0;
for(int i = 0; i < bad_milks_common.size(); i++) {
int counter = 0;
for(int j = 0; j < pmts.length; j++) {
for(int k = 0; k < pmts[j].length; k++) {
counter++;
break;
}
}
}
if(counter>res) {
res = counter;
}
}
}

System.out.println(res);
pw.println(res);
pw.close();
}
}