답안 #923913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
923913 2024-02-08T06:20:38 Z yeediot Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
0 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#ifdef local
void setio(){freopen("/Users/iantsai/Library/Mobile Documents/com~apple~CloudDocs/cpp/Empty.md","r",stdin);}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
void setio(){}
#define debug(x...)
#endif
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    setio();
    int n;
    cin>>n;
    vector<int>a(n+1);
    for(int i=0;i<=n;i++){
        cin>>a[i];
    }
    vector<int>b(n);
    for(int i=0;i<n;i++)cin>>b[i];
    sort(all(a));
    sort(all(b));
    multiset<int>st;
    for(int i=1;i<=n;i++){
        st.insert(max(a[i]-b[i-1],0LL));
    }
    cout<<*st.rbegin()<<' ';
    for(int i=1;i<=n;i++){
        st.erase(st.find(max(a[i]-b[i-1],0LL)));
        st.insert(max(a[i-1]-b[i-1],0LL));
        cout<<*st.rbegin()<<' ';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -