Skip to content

Instantly share code, notes, and snippets.

@estelabn
Created August 18, 2023 00:49
Show Gist options
  • Save estelabn/e89b3d7fa6741447ebca1e2b540fbd53 to your computer and use it in GitHub Desktop.
Save estelabn/e89b3d7fa6741447ebca1e2b540fbd53 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,E,D;
cin >> N >> E >> D;
int resposta = -1;
for(int i=0; i<N; i++){
int e,d;
cin >> e >> d;
int oculos = abs(E-e) + abs(D-d);
if(resposta == -1) resposta = oculos;
else resposta = min(resposta, oculos);
}
cout << resposta << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment