Rezultati

Up. imeNalogaJezikRezultatČas oddaje
vlakec-tomaz-in-ekipa-raketa-2019 Ocenjevanje univerz C++ 100/100OK 24. apr '19 @ 18:44

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 10/10 3,117 MiB 0,073 s OK
#2 [več] 10/10 3,277 MiB 0,130 s OK
#3 [več] 10/10 3,000 MiB 0,171 s OK
#4 [več] 10/10 3,129 MiB 0,091 s OK
#5 [več] 10/10 3,125 MiB 0,051 s OK
#6 [več] 10/10 3,125 MiB 0,085 s OK
#7 [več] 10/10 3,004 MiB 0,189 s OK
#8 [več] 10/10 3,152 MiB 0,165 s OK
#9 [več] 10/10 3,148 MiB 0,027 s OK
#10 [več] 10/10 3,277 MiB 0,113 s OK

Ocenjevani program (univerze.cpp):
# include <iostream>

using namespace std;

int main(){
    int n;
    double xmin=0.0, xmax=1.0;
    bool ok=1;
    cin>>n;
    int a1,b1;
    cin>>a1>>b1;
    for (int i=1;i<n;++i){
        int a,b;
        cin>>a>>b;
        if(a1-a==0){
            if(b-b1!=0){xmin=1.0;}
            continue;
        }
        if(a1-a>0){
            if(b-b1==-(a1-a)){
                continue;
            }
            else if(double(b-b1)/double(a1-a)>-1.0){
                double xtemp=double(b-b1)/double(a1-a)/(1.0+double(b-b1)/double(a1-a));
                if(xtemp>xmin) xmin=xtemp;
            }
            else {
                double xtemp=double(b-b1)/double(a1-a)/(1.0+double(b-b1)/double(a1-a));
                if(xtemp<xmax) xmax=xtemp; 
            }
        }
        if(a1-a<0){
         if(b-b1==-(a1-a)){
                ok=0;
                //break;
            }
            else if(double(b-b1)/double(a1-a)>-1.0){
                double xtemp=double(b-b1)/double(a1-a)/(1.0+double(b-b1)/double(a1-a));
                if(xtemp<xmax) xmax=xtemp; 
            }
            else {
                double xtemp=double(b-b1)/double(a1-a)/(1.0+double(b-b1)/double(a1-a));
                if(xtemp<xmax) xmax=xtemp; 
            }
        }


    }
    if(xmin>xmax or xmin>1.0 or xmax>1.0 or xmin<0.0 or xmax<0.0)
        ok=0;
    if(ok) cout<<(xmax+xmin)/2.0<<" "<<1.0-(xmax+xmin)/2.0<<endl;
    else cout<<"Slabe metrike"<<endl;
}