Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit 36d0480

Browse files
committed
Rewrite
1 parent 1b934a2 commit 36d0480

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/convention2.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ public int compare(cow arg0, cow arg1) {
4949
maxsenority = -1;
5050
//cow nextcow = new cow(-1,-1); // Not guaranteed to have a conflicting time
5151
int count = 0;
52-
while(true) {
52+
while(cows_eaten<N &&time.get(cows_eaten).x < ctime) {
5353
cows_eaten++;
54-
if(cows_eaten>=N ||time.get(cows_eaten).x >= ctime) { // If after the current cow is finished then all cows after it we don't have to worry about
55-
break;
56-
}else {
57-
count ++;
58-
theline.add(time.get(cows_eaten));
59-
}
54+
count ++;
55+
theline.add(time.get(cows_eaten));
6056
}
6157
if(count>0) {theline.sort(cowcompare);}
6258
}

0 commit comments

Comments
 (0)