Submission #790369

# Submission time Handle Problem Language Result Execution time Memory
790369 2023-07-22T15:18:12 Z Valters07 Measures (CEOI22_measures) C++14
59 / 100
158 ms 5424 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
    fio
//    ifstream cin("in.in");
    int n, m, d;
    cin >> n >> m >> d;
    if(n>0)
    {
        vector<int> a(n);
        for(auto &x:a)
            cin >> x;
        while(m--)
        {
            int x;
            cin >> x;
            a.pb(x);
            sort(a.begin(),a.end());
            n = a.size();
            vector<ll> c(n);
            for(int i = 0;i<n;i++)
                c[i]=1ll*d*i-a[i];
            ll mi = 1e18, res = -1e18;
            for(int i = 0;i<n;i++)
                res=max(res,c[i]-mi),
                mi=min(mi,c[i]);
            cout << res/2;
            if(res%2)
                cout << ".5";
            cout << " ";
        }
    }
    else
    {
        ll mi = 1e18, res = 0;
        for(int i = 0;i<m;i++)
        {
            int x;
            cin >> x;
            ll c = 1ll*d*i-x;
            res=max(res,c-mi);
            mi=min(mi,c);
            cout << res/2;
            if(res%2)
                cout << ".5";
            cout << " ";
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 103 ms 2664 KB Output is correct
10 Correct 146 ms 2620 KB Output is correct
11 Correct 46 ms 2644 KB Output is correct
12 Correct 158 ms 2652 KB Output is correct
13 Correct 44 ms 2628 KB Output is correct
14 Correct 94 ms 2628 KB Output is correct
15 Correct 92 ms 2664 KB Output is correct
16 Correct 45 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2920 KB Output is correct
2 Correct 38 ms 5144 KB Output is correct
3 Correct 36 ms 5068 KB Output is correct
4 Correct 28 ms 3012 KB Output is correct
5 Correct 32 ms 4256 KB Output is correct
6 Correct 34 ms 3276 KB Output is correct
7 Correct 37 ms 4328 KB Output is correct
8 Correct 31 ms 2984 KB Output is correct
9 Correct 32 ms 3028 KB Output is correct
10 Correct 36 ms 5424 KB Output is correct
11 Correct 38 ms 3832 KB Output is correct
12 Correct 34 ms 4776 KB Output is correct
13 Correct 33 ms 3040 KB Output is correct
14 Correct 34 ms 4920 KB Output is correct
15 Correct 35 ms 4808 KB Output is correct
16 Correct 30 ms 2616 KB Output is correct
17 Correct 40 ms 4204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 2920 KB Output is correct
2 Correct 38 ms 5144 KB Output is correct
3 Correct 36 ms 5068 KB Output is correct
4 Correct 28 ms 3012 KB Output is correct
5 Correct 32 ms 4256 KB Output is correct
6 Correct 34 ms 3276 KB Output is correct
7 Correct 37 ms 4328 KB Output is correct
8 Correct 31 ms 2984 KB Output is correct
9 Correct 32 ms 3028 KB Output is correct
10 Correct 36 ms 5424 KB Output is correct
11 Correct 38 ms 3832 KB Output is correct
12 Correct 34 ms 4776 KB Output is correct
13 Correct 33 ms 3040 KB Output is correct
14 Correct 34 ms 4920 KB Output is correct
15 Correct 35 ms 4808 KB Output is correct
16 Correct 30 ms 2616 KB Output is correct
17 Correct 40 ms 4204 KB Output is correct
18 Incorrect 33 ms 4464 KB Output isn't correct
19 Halted 0 ms 0 KB -