D. Teleportation
λ¬Έμ μ€λͺ
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
// your code goes here
int a, b, x, y;
cin >> a >> b >> x >> y;
if(x > y){
swap(x, y);
}
printf("%d", min(min(abs(a-x) + abs(b-y), abs(b-a)), abs(a-y) + abs(b-x)));
return 0;
}Last updated