Skip to content

Commit 023b5e0

Browse files
Merge pull request #3474 from cpinitiative/hoofball
hints for hoofball, bronze
2 parents 164b598 + 6be0581 commit 023b5e0

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

solutions/bronze/usaco-808.mdx

+24-8
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ title: Hoofball
55
author: Ryan Chou, Ben Dodge, Arpan Banerjee
66
---
77

8-
[Official Analysis (C++)](http://www.usaco.org/current/data/sol_hoofball_bronze_feb18.html)
9-
108
## Video Solution
119
By Arpan Banerjee
1210

@@ -61,7 +59,6 @@ int main(){
6159
```
6260

6361
</CPPSection>
64-
6562
<JavaSection>
6663

6764
```java
@@ -126,11 +123,27 @@ class Main {
126123
}
127124
}
128125
```
129-
</JavaSection>
130126
127+
</JavaSection>
131128
</LanguageSection>
132129
</Spoiler>
133130
131+
<Spoiler title="Hint 1">
132+
133+
Play with the sample input, and draw out other cases.
134+
135+
</Spoiler>
136+
137+
<Spoiler title="Hint 2">
138+
139+
When will a ball get stuck in an infinite loop?
140+
141+
</Spoiler>
142+
143+
<Spoiler title="Solution">
144+
145+
[Official Analysis (C++)](http://www.usaco.org/current/data/sol_hoofball_bronze_feb18.html)
146+
134147
## Explanation
135148
136149
First, let's realize that Farmer John will need another ball in one of two cases:
@@ -141,6 +154,7 @@ So, each time this occurs we can count it and return this total count as our ans
141154
We can do this first by finding which cow, if any, every cow passes the ball to.
142155
143156
## Implementation
157+
144158
**Time Complexity:** $\mathcal{O}(N^2)$
145159
146160
<LanguageSection>
@@ -195,6 +209,7 @@ for i in range(n):
195209

196210
print(ans)
197211
```
212+
198213
</PySection>
199214
<CPPSection>
200215
@@ -262,7 +277,6 @@ int main() {
262277
```
263278
264279
</CPPSection>
265-
266280
<JavaSection>
267281
268282
```java
@@ -336,9 +350,11 @@ public class Hoofball {
336350
io.println(ballsNeeded);
337351
io.close();
338352
}
339-
// CodeSnip{Kattio}
353+
354+
//CodeSnip{Kattio}
340355
}
341-
342-
```
356+
```
357+
343358
</JavaSection>
344359
</LanguageSection>
360+
</Spoiler>

0 commit comments

Comments
 (0)