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

Commit 8e21161

Browse files
committed
Almost working code
This code is only working for case 1
1 parent 1dfd4b4 commit 8e21161

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

convention2.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-1
1+
10

src/convention2.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public int compare(cow arg0, cow arg1) {
3333
cow c2;
3434
int cows_eaten = 0;
3535
int maxsenority;
36-
System.out.println(time);
37-
while(cows_eaten < N) {
36+
//System.out.println(time);
37+
while(cows_eaten < N || theline.size() > 0) {
3838
if(theline.isEmpty()) {
3939
tc = time.get(cows_eaten);
4040
ctime = tc.x;
@@ -48,11 +48,11 @@ public int compare(cow arg0, cow arg1) {
4848
}
4949
ctime = ctime + tc.y;
5050
maxsenority = -1;
51-
//cow nextcow = new cow(-1,-1); // Not guarented to have a conflicting time
51+
//cow nextcow = new cow(-1,-1); // Not guaranteed to have a conflicting time
5252
int count = 0;
5353
while(true) {
5454
cows_eaten++;
55-
if(time.get(cows_eaten).x >= ctime || theline.contains(time.get(cows_eaten))) { // If after the current cow is finsihed then all cows after it we don't have to worry about
55+
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
5656
break;
5757
}else {
5858
count ++;

0 commit comments

Comments
 (0)