Skip to content

Commit

Permalink
small refactor done
Browse files Browse the repository at this point in the history
  • Loading branch information
javaarchive committed Jul 4, 2020
1 parent 1bf29be commit 420ed69
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions USACOClassLiveTest/src/photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ public int compare(Compliant o1, Compliant o2) {
int currentPos = compliants.get(0).y - 1;
//System.out.println(compliants);
System.out.println("Set currentPos initially to "+prevPos+" "+currentPos);
for(Compliant c: compliants){
System.out.println("COMPLIANT: "+c);
if(c.y > currentPos && c.x <= currentPos && prevPos <= c.x){
for(int i = 0; i < M-1; i ++){
Compliant c1 = compliants.get(i);
Compliant c2 = compliants.get(i+1);
System.out.println("COMPLIANT: "+c1);
if(c1.y > currentPos && c1.x <= currentPos && prevPos <= c1.x){
prevPos = currentPos+1;
currentPos = c.y;
System.out.println("NEW: " + currentPos+" "+c.x+" "+c.y);
currentPos = c2.y;
System.out.println("NEW: " + currentPos+" "+c1.x+" "+c1.y);
photos ++;
}else if(c.y > currentPos && c.x > currentPos){
}else if(c1.y > currentPos && c1.x > currentPos){
prevPos = currentPos+1;
currentPos = c.y;
currentPos = c2.y;
photos ++;
}
System.out.println("RANGE :"+prevPos+" "+currentPos);
Expand Down

0 comments on commit 420ed69

Please sign in to comment.