Pagini recente » Cod sursa (job #521928) | Cod sursa (job #3198313) | Cod sursa (job #109885) | Cod sursa (job #1095101) | Cod sursa (job #2837013)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
using namespace std;
ifstream fin("ograzi.in");
ofstream fout("ograzi.out");
const int inf = 0x3f3f3f3f;
int n, m, lung, lat, ans;
struct coords{
int x, y;
}v[50005], bee[100005];
multiset <int> curte;
multiset <int> :: iterator it;
string s;
void citire()
{
getline(fin, s);
s = s + ' ';
int ind = 0, semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
n = semn * nr;
ind++;
semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
m = semn * nr;
ind++;
semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
lung = semn * nr;
ind++;
semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
lat = semn * nr;
for(int i = 1; i <= n; i++)
{
getline(fin, s);
s = s + ' ';
int ind = 0, semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
v[i].x = semn * nr;
ind++;
semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
v[i].y = semn * nr;
}
for(int i = 1; i <= m; i++)
{
getline(fin, s);
s = s + ' ';
int ind = 0, semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
bee[i].x = semn * nr;
ind++;
semn = 1, nr = 0;
if(s[ind] == '-')
{
semn = -1;
ind++;
}
while(s[ind] != ' ')
{
nr = nr * 10 + (s[ind] - '0');
ind++;
}
bee[i].y = semn * nr;
}
}
int main()
{
citire();
return 0;
}