Submission #723355

# Submission time Handle Problem Language Result Execution time Memory
723355 2023-04-13T16:03:14 Z anton Measures (CEOI22_measures) C++17
0 / 100
1500 ms 1004 KB
#include<bits/stdc++.h>

using namespace std;

int double_cost(multiset<int>& s, int d){
    int delta = 0;
    int first = *s.begin();


    multiset<int> s2;

    for(auto e: s){
        s2.insert(e-first);
    }
    int rank = 0;
    int cost =0;
    //cout<<"size "<<s2.size()<<endl;
    for(auto e: s2){
        //cout<<"element "<<e<<endl;
        if(rank*d + delta< e){
            delta += e - rank*d;
        }

        //cout<<rank<<endl;
        

        cost = max(cost, rank*d + delta - e);
        rank++;
    }

    return cost;
}

int main(){
    int n, m, d;
    cin>>n>>m>>d;

    multiset<int> ppl;

    for(int i = 0; i<n; i++){
        int a;
        cin>>a;
        ppl.insert(a);
    }

    for(int i = 0; i<m; i++){
        int b;
        cin>>b;

        ppl.insert(b);
        cout<<(double)double_cost(ppl, d) / 2.0<<" ";

    }


}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1548 ms 1004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1548 ms 1004 KB Time limit exceeded
2 Halted 0 ms 0 KB -