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 1288. Astrolocation

Why I get WA test #6??? Please help me!!!
Posted by I am get tester... 14 Aug 2005 15:29
#include <stdio.h>

int N, D, S1, E1, L1, S2, E2, L2;
double A, arr[10001];

int main()
{
    int i, start = 0, end = 0, one, pos1 = 0, pos2 = 0;
    arr[0] = -1e10;

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);


    scanf("%d %d %d %d %d %d %d %d %lf", &N, &D, &S1, &E1, &L1, &S2, &E2, &L2, &A);
    for (i = 1; i <= N; i++)
        scanf("%lf", &arr[i]);

    for (i = 1; i <= N; i++)
    {
        if (arr[i] <= 35) break;
    }

    for (++i; i <= N; i++)
    {
        if (arr[i] >= 95)
        {
            start = i;
            break;
        }
    }

    if (start == 0)
    {
        printf("No surface.\n");
        return 0;
    }
    else
    {
        printf("Surface found at %d.\n", start);
    }

    for (i = start; i <= N; i++)
    {
        arr[i] *= 1 + (i - start) * A;
    }


    for (i = start + 1; i <= N; i++)
    {
        if (arr[i] <= 35) break;
    }

    if (i < start + D) i = start + D;

    for (; i <= N; i++)
    {
        if (arr[i] >= 95)
        {
            end = i;
            break;
        }
    }

    if (end == 0)
    {
        printf("No bottom.\n");
        end = N;
    }
    else
    {
        printf("Bottom found at %d.\n", end - start);
    }

    S1 += start;
    E1 += start;
    if (E1 > end) E1 = end;
    one = 0;

    for (i = S1; i <= E1; i++)
    {
        one = 1;

        if (arr[i] > arr[pos1]) pos1 = i;
    }

    if (one == 0)
    {
        printf("Channel 1: No search.\n");
    }
    else
    {
        if (arr[pos1] >= L1) printf("Channel 1: Object at %d.\n", pos1 - start);
        else printf("Channel 1: No object.\n");
    }

    S2 += start;
    E2 += start;
    if (E2 > end) E2 = end;
    one = 0;

    for (i = S2; i <= E2; i++)
    {
        one = 1;

        if (arr[i] > arr[pos2]) pos2 = i;
    }

    if (one == 0)
    {
        printf("Channel 2: No search.\n");
    }
    else
    {
        if (arr[pos2] >= L2) printf("Channel 2: Object at %d.\n", pos2 - start);
        else printf("Channel 2: No object.\n");
    }

    return 0;
}
Re: Why I get WA test #6??? Please help me!!!
Posted by Danica Porobic 28 Aug 2005 03:18
Object cannot be located on the back wall.
Re: Why I get WA test #6??? Please help me!!!
Posted by Denis Koshman 20 Aug 2008 21:30
I think this should be put to problem statement because it tells that objects cannot be BEHIND the back wall (at least eng. version)