Rezultati

Up. imeNalogaJezikRezultatČas oddaje
the-org-2019 Ocenjevanje univerz C++ 100/100OK 24. apr '19 @ 18:38

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 10/10 3,656 MiB 0,085 s OK
#2 [več] 10/10 3,832 MiB 0,142 s OK
#3 [več] 10/10 3,758 MiB 0,171 s OK
#4 [več] 10/10 3,516 MiB 0,085 s OK
#5 [več] 10/10 3,461 MiB 0,033 s OK
#6 [več] 10/10 3,516 MiB 0,091 s OK
#7 [več] 10/10 3,758 MiB 0,153 s OK
#8 [več] 10/10 3,762 MiB 0,177 s OK
#9 [več] 10/10 3,125 MiB 0,027 s OK
#10 [več] 10/10 3,801 MiB 0,131 s OK

Ocenjevani program (main.cpp):
#include <bits/stdc++.h>
 
#define f first
#define s second
#define mp make_pair
#define pb push_back
 
using namespace std;
 
typedef long double ld;

const int maxn = 1e5 + 17;
 
int N;
int x, y;
 
ld a = 0.0, b = 0.0;
 
bool xx;

int in[2][maxn];
 
int main()
{
    cin >> N >> x >> y;
    for (int i = 1; i < N; i++) cin >> in[0][i] >> in[1][i];

    for (int i = 1; i < N; i++) {
        int _x = in[0][i], _y = in[1][i];
        if (xx) continue;
 
        if (a * x + (1.0 - a) * y >= a * _x + (1 - a) * _y) continue;
        if (x - _x + _y - y == 0) xx = true;
        if (xx) continue;

        a = max(a, (ld) 1.0 * (_y - y) / (1.0 * (x - _x + _y - y)));
    }

    for (int i = 1; i < N; i++) {
        int _x = in[0][i], _y = in[1][i];
        if (a * x + (1.0 - a) * y < a * _x + (1 - a) * _y) xx = true;
    }
 
    if (xx) cout << "Slabe metrike" << endl;
    else cout << fixed << setprecision(17) << a << " " << (ld) (1.0 - a) << endl;
 
    return 0;
}