답안 #723407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723407 2023-04-13T17:53:16 Z anton Measures (CEOI22_measures) C++17
0 / 100
1500 ms 812 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long

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;
}

int32_t 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<<" ";

  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 4 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 468 KB Output is correct
2 Incorrect 4 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1560 ms 812 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1560 ms 812 KB Time limit exceeded
2 Halted 0 ms 0 KB -