ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1884. Way to the University

WA25, help me please
Posted by Artyom Averin [Psych Up club] 4 Aug 2012 00:41
Please help me, guys, I don't know what's the problem:(


#include <iostream>

using namespace std;


int lft[320], rght[320];

double timeleft[320], timeright[320];

double const eps = 0.0000001;

int main(){
    int n,m;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> lft[i];
        timeleft[i] = (lft[i] + 5.000)*9/50;
    }
    cin >> m;
    for(int i = 1; i <= m; i++){
        cin >> rght[i];
        timeright[i] = (rght[i]+5.000)*9/50 - 36.000/25;
    }

    double ans = 1000000000;

    if(lft[1] >= 8 && (rght[1] >= 16  || (rght[1] <= 3 && (rght[2] >= 16 || m == 1)))){
        cout << 0;
        return 0;
    }



    for(int i = 1; i <= n; i++){
        double cur = timeleft[i];
        bool b = 0;
        if(lft[i+1] - lft[i] >= 13 || lft[i+1] == 0){

            for(int j = 1; j <= n; j++){
                double temp = rght[j] - (cur + 36.000/25)*200.000/36;
                if(temp > -5 + eps && temp + eps < 8)
                    b = 1;
            }

        }
        else b = 1;
        if(!b && cur + eps < ans)
            ans = cur;
    }

    for(int i = 1; i <= m; i++){
        double cur = timeright[i];
        bool b = 0;
        if(rght[i+1] - rght[i] >= 13 || rght[i+1] == 0){

            for(int j = 1; j <= n; j++){
                double temp = lft[j] - cur*200.000/36;
                if(temp - eps > -5  && temp + eps < 8)
                    b = 1;
            }

        }
        else b = 1;
        if(!b && cur + eps < ans)
            ans = cur;
    }

printf("%.9f",ans);
return 0;
}