답안 #918745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918745 2024-01-30T10:52:29 Z Aiperiii Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
   ios_base::sync_with_stdio();
   cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   vector <int> a(n+1),b(n);
   for(int i=0;i<=n;i++)cin>>a[i];
   for(int i=0;i<n;i++)cin>>b[i];
   sort(all(b));sort(all(a));
   multiset <int> ms;
   for(int i=0;i<n;i++){
      ms.insert(max(0ll,a[i]-b[i]));
   }
   vector <int> ans;
   ans.pb(*ms.rbegin());
   for(int i=n;i>=1;i--){
      ms.erase(ms.find(max(0ll,a[i-1]-b[i-1])));
      ms.insert(max(0ll,a[i]-b[i-1]));
      ans.pb(*ms.rbegin());
   }
   reverse(all(ans));
   for(auto x : ans)cout<<x<<" ";
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -