Skip to content

Commit

Permalink
???????
Browse files Browse the repository at this point in the history
  • Loading branch information
javaarchive committed Jul 5, 2020
1 parent 0880d47 commit 96fdb8b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions USACOClassLiveTest/src/fairphoto.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,20 @@ public int compare(Livestock arg0, Livestock arg1) {
}else{
//Hcount ++;
}*/
bal += cow.type ? -1: 1;
ps[i] = bal;
seen[(bal+N)] = i;
ps[i] = bal;
bal += cow.type ? -1: 1;
}
System.out.println(Arrays.toString(ps));
int ans = 0;
for(int i = 0; i < N; i ++){
int result = seen[ps[i] + N];
//System.out.println("Q:"+ps[i]+" "+result);
if(result != -1 && result > i){
ans = Integer.max(ans, cows.get(result).index - cows.get(i).index);
//result = Integer.max(result, i);
if(result != -1 && result >= i){
ans = Integer.max(ans, cows.get(result).index - cows.get(i).index);
}
//result = seen[ps[i] + N];
System.out.println("P:"+ps[i]+" ::"+i+" "+result);
System.out.println("I:"+cows.get(result).index+" "+cows.get(i).index);
}
Expand All @@ -81,7 +83,7 @@ public int compare(Livestock arg0, Livestock arg1) {
}
}
// G, H, G, G, H, G.
//
// -1,0,-1,-2,-1,-2
class Livestock{
boolean type;
int index;
Expand Down

0 comments on commit 96fdb8b

Please sign in to comment.