Files
usaco/solved/sleepy-cow-herding/main.cpp
T
2026-08-03 19:03:58 +01:00

31 lines
535 B
C++

#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
freopen("herding.in", "r", stdin);
freopen("herding.out", "w", stdout);
uint pos[3];
for (int i = 0; i < 3; i++) {
cin >> pos[i];
}
sort(pos, pos + 3);
uint x = pos[0], y = pos[1], z = pos[2];
uint minnn = 0;
if (z == x + 2) {
minnn = 0;
} else if (y == x + 2 or z == y + 2) {
minnn = 1;
} else {
minnn = 2;
}
uint maxxx = max(y - x - 1, z - y - 1);
cout << minnn << '\n' << maxxx << endl;
}