Submission #973178

# Submission time Handle Problem Language Result Execution time Memory
973178 2024-05-01T15:25:05 Z Everule Measures (CEOI22_measures) C++17
24 / 100
1500 ms 3960 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
void solve(){
    int n,m;
    ll d;
    cin>>n>>m>>d;
    vector<int> a(n);
    cin>>a;
    auto solve_array = [&](vector<int> a){
        sort(a.begin(), a.end());
        ll mn_prev = -a[0];
        ll ans = 0;
        for(int i=1;i<n;i++){
            ans = max(ans, i * d - a[i] - mn_prev);
            mn_prev = min(mn_prev, i * d - a[i]);
        }
        if(ans % 2) cout<<ans / 2<<".5 ";
        else cout<<ans / 2<<" ";
    };
    for(int i=0;i<m;i++){
        int v;
        cin>>v;
        a.push_back(v);
        ++n;
        solve_array(a);
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 484 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 484 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 732 KB Output is correct
9 Correct 150 ms 3932 KB Output is correct
10 Correct 122 ms 3932 KB Output is correct
11 Correct 52 ms 3960 KB Output is correct
12 Correct 189 ms 3916 KB Output is correct
13 Correct 41 ms 3420 KB Output is correct
14 Correct 78 ms 3932 KB Output is correct
15 Correct 145 ms 3164 KB Output is correct
16 Correct 49 ms 3800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1545 ms 808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1545 ms 808 KB Time limit exceeded
2 Halted 0 ms 0 KB -