답안 #719591

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
719591 2023-04-06T10:19:26 Z Rafi22 Measures (CEOI22_measures) C++14
59 / 100
383 ms 5384 KB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define int long long
#define ll long long
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

signed main()
{
    int n,m,d,x;
    cin>>n>>m>>d;
    d*=2;
    vector<int>a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]*=2;
    }
    if(n>0)
    {
        for(int i=0; i<m; i++)
        {
            cin>>x;
            a.pb(2*x);
            sort(all(a));
            int l=a[0],k=0;
            for(int j=1; j<n+i+1; j++)
            {
                if(l+d>a[j]+k)
                {
                    int m=(l+d-a[j]-k)/2;
                    k+=m;
                    l+=d-m;
                }
                else l=max(a[j]-k,l+d);
            }
            if(k%2==1) cout<<k/2<<".5"<<" ";
            else cout<<k/2<<" ";
        }
    }
    else
    {
        int l=0,k=0;
        for(int i=0;i<m;i++)
        {
            cin>>x;
            x*=2;
            if(i==0)
            {
                l=x;
                cout<<0<<" ";
                continue;
            }
            if(l+d>x+k)
            {
                int m=(l+d-x-k)/2;
                k+=m;
                l+=d-m;
            }
            else l=max(x-k,l+d);
            if(k%2==1) cout<<k/2<<".5"<<" ";
            else cout<<k/2<<" ";
        }
    }


    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 176 ms 3408 KB Output is correct
10 Correct 224 ms 3404 KB Output is correct
11 Correct 102 ms 3400 KB Output is correct
12 Correct 262 ms 3392 KB Output is correct
13 Correct 100 ms 3404 KB Output is correct
14 Correct 175 ms 3408 KB Output is correct
15 Correct 144 ms 3396 KB Output is correct
16 Correct 117 ms 3392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 2812 KB Output is correct
2 Correct 383 ms 5080 KB Output is correct
3 Correct 334 ms 5112 KB Output is correct
4 Correct 316 ms 2892 KB Output is correct
5 Correct 339 ms 4260 KB Output is correct
6 Correct 330 ms 3368 KB Output is correct
7 Correct 331 ms 4320 KB Output is correct
8 Correct 370 ms 2952 KB Output is correct
9 Correct 324 ms 2928 KB Output is correct
10 Correct 324 ms 5384 KB Output is correct
11 Correct 335 ms 3696 KB Output is correct
12 Correct 333 ms 4688 KB Output is correct
13 Correct 322 ms 2924 KB Output is correct
14 Correct 321 ms 4868 KB Output is correct
15 Correct 334 ms 4748 KB Output is correct
16 Correct 315 ms 2568 KB Output is correct
17 Correct 380 ms 4224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 317 ms 2812 KB Output is correct
2 Correct 383 ms 5080 KB Output is correct
3 Correct 334 ms 5112 KB Output is correct
4 Correct 316 ms 2892 KB Output is correct
5 Correct 339 ms 4260 KB Output is correct
6 Correct 330 ms 3368 KB Output is correct
7 Correct 331 ms 4320 KB Output is correct
8 Correct 370 ms 2952 KB Output is correct
9 Correct 324 ms 2928 KB Output is correct
10 Correct 324 ms 5384 KB Output is correct
11 Correct 335 ms 3696 KB Output is correct
12 Correct 333 ms 4688 KB Output is correct
13 Correct 322 ms 2924 KB Output is correct
14 Correct 321 ms 4868 KB Output is correct
15 Correct 334 ms 4748 KB Output is correct
16 Correct 315 ms 2568 KB Output is correct
17 Correct 380 ms 4224 KB Output is correct
18 Incorrect 326 ms 4552 KB Output isn't correct
19 Halted 0 ms 0 KB -