Cod sursa(job #2837013)

Utilizator toma_ariciuAriciu Toma toma_ariciu Data 21 ianuarie 2022 15:02:29
Problema Ograzi Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 2.61 kb
#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;
}