Pagini recente » Cod sursa (job #142332) | Cod sursa (job #2030779) | Cod sursa (job #1621084) | Cod sursa (job #2760216) | Cod sursa (job #1635124)
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin ("pachete.in");
ofstream fout ("pachete.out");
struct livrare
{
int x, y, ok;
} A[10001], st;
int n, nrdr;
bool cmp(livrare const a, livrare const b)
{
if (a.x > b.x)return true;
else if (a.x == b.x && a.y > b.y)return true;
return false;
}
bool intre(int b, int c, int nr)
{
if (b >= nr && c<=nr)return true;
else if (b <=nr && c >= nr)return true;
return false;
}
int main()
{
fin >> n >> st.x >> st.y;
for (int i=1; i<=n; i++)fin >> A[i].x >> A[i].y;
nrdr=n;
sort(A+1, A+1+n, cmp);
for (int i=1; i<=n; i++)
for (int j=1; j<=n; j++)
{
if (intre(A[i].x, st.x, A[j].x) == true && intre(A[i].y, st.y, A[j].y) == true && A[j].ok==0 && j != i)
{
nrdr--;
A[j].ok=1;
j = n+1;
}
}
fout << nrdr;
return 0;
}