[USACO](https://USACO problem)
I was unable to figure out what was wrong with my code. This is what I wrote:
#include
#include
#include
using namespace std;
int main(){
ifstream fin (“teleport.in”);
ofstream fout (“teleport.out”);
int start{};
int end{};
int tele1{};
int tele2{};
fin >> start >> end >> tele1 >> tele2;
if (tele2 < tele1)
swap(tele2, tele1);
if (abs(end - start) < abs(tele1 - start) + abs(end - tele2)){
fout << abs(end - start);
}
else
fout << abs(tele1 - start) + abs(end - tele2);
return 0;
}
If somebody could help me that would be great. For some reason this code fails on one of the tests.