Submission #711439

# Submission time Handle Problem Language Result Execution time Memory
711439 2023-03-17T01:41:31 Z ToroTN Measures (CEOI22_measures) C++14
0 / 100
175 ms 13868 KB
#include<bits/stdc++.h>
using namespace std;
int n,m,d,a,ans=0,l,r;
double chng;
multiset<int> ms;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n >> m >> d;
    for(int i=1;i<=n+m;i++)
    {
        cin >> a;
        if(ms.size()==0)
        {
            ms.insert(a);
            chng=ans/2;
            if(i>n)
            {
                if(floor(chng)==chng)
                {
                    printf("%.0f ",chng);
                }else
                {
                    printf("%.1f ",chng);
                }
            }
            continue;
        }
        auto it=ms.lower_bound(a);
        if(it==ms.end())
        {
            --it;
            ans+=(d-(a-(*it)));
        }else if(it==ms.begin())
        {
            ans+=(d-((*it)-a));
        }else
        {
            r=(*it);
            --it;
            l=(*it);
            ans-=(d-(r-l));
            ans+=(d-(a-l));
            ans+=(d-(r-a));
        }
        ms.insert(a);
        chng=(double)ans/2;
        if(i>n)
        {
            if(floor(chng)==chng)
            {
                printf("%.0f ",chng);
            }else
            {
                printf("%.1f ",chng);
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 13868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 13868 KB Output isn't correct
2 Halted 0 ms 0 KB -