USACO Bronze 2016 January - Angry Cows

Author: Óscar Garries

Official Analysis

The official solution doesn't seem to work on the following test case:

4
1
2
4
6

The answer should be 4.

C++

Implementation

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
freopen("angry.in", "r", stdin);

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!