Submission #60992683


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
//#define int long long
double x[1000005],h[1000005],ans=-10000000000000;
int n;
signed main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>x[i]>>h[i];
        if(i!=1)ans=max(ans,h[i]-x[i]*((h[i]-h[i-1])/(x[i]-x[i-1])));
    }
    if(!abs(ans)<1e-8&&ans<0)cout<<-1;
    else printf("%.12lf",ans);
    return 0;
}

Submission Info

Submission Time
Task F - Visible Buildings
User FIRESTARS
Language C++ 20 (gcc 12.2)
Score 0
Code Size 425 Byte
Status WA
Exec Time 50 ms
Memory 6876 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:15:17: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   15 |     if(!abs(ans)<1e-8&&ans<0)cout<<-1;
      |                 ^
Main.cpp:15:8: note: add parentheses around left hand side expression to silence this warning
   15 |     if(!abs(ans)<1e-8&&ans<0)cout<<-1;
      |        ^~~~~~~~~
      |        (        )

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 525
Status
AC × 4
AC × 25
WA × 2
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
hand_01.txt WA 1 ms 3608 KiB
hand_02.txt AC 1 ms 3612 KiB
hand_03.txt AC 1 ms 3756 KiB
hand_04.txt AC 1 ms 3612 KiB
random_01.txt AC 50 ms 6876 KiB
random_02.txt AC 37 ms 6124 KiB
random_03.txt AC 31 ms 5752 KiB
random_04.txt AC 16 ms 4804 KiB
random_05.txt AC 36 ms 6036 KiB
random_06.txt AC 19 ms 4952 KiB
random_07.txt AC 7 ms 4164 KiB
random_08.txt AC 25 ms 5356 KiB
random_09.txt AC 4 ms 4032 KiB
random_10.txt AC 11 ms 4484 KiB
random_11.txt AC 31 ms 5796 KiB
random_12.txt AC 22 ms 5080 KiB
random_13.txt WA 6 ms 4120 KiB
random_14.txt AC 12 ms 4608 KiB
random_15.txt AC 38 ms 6144 KiB
random_16.txt AC 33 ms 5920 KiB
random_17.txt AC 24 ms 5412 KiB
random_18.txt AC 35 ms 6160 KiB
random_19.txt AC 27 ms 5696 KiB
sample_01.txt AC 1 ms 3820 KiB
sample_02.txt AC 1 ms 3632 KiB
sample_03.txt AC 1 ms 3820 KiB
sample_04.txt AC 1 ms 3932 KiB