Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Aquasonic-2018 Presek C++ 100/100OK 04. okt '18 @ 18:07

Test Točke Porabljen spomin Porabljen čas Status
#1 100/100 3,238 MiB 0,050 s OK

Ocenjevani program (mainx.cpp):
#include <bits/stdc++.h>
 
#define f first
#define s second
#define pb push_back
#define INF (1 << 27)
#define INFLL (1LL << 51)
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
 
const int maxn = 217; 
int Q;
 
bool inc(int X, int Y, int x, int y, int r)
{
    return (X - x) * (X - x) + (Y - y) * (Y - y) <= r * r;
}
 
bool inr(int X, int Y, int x1, int y1, int x2, int y2)
{
    return X >= x1 && X <= x2 && Y >= y1 && Y <= y2;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
 
    cin >> Q;
    while (Q--) {
        int X1, Y1, X2, Y2, XK, YK, R;
        cin >> X1 >> Y1 >> X2 >> Y2 >> XK >> YK >> R;

        for (int i = -maxn; i <= maxn; i++)
            for (int j = -maxn; j <= maxn; j++)
                if (inc(i, j, XK, YK, R) && inr(i, j, X1, Y1, X2, Y2)) {
                    cout << i << " " << j << endl;
                    goto done;
                }
        
        cout << "Presek je prazen" << endl;
        done: true;
    }
 
    return 0;
}