Submission #1023686

# Submission time Handle Problem Language Result Execution time Memory
1023686 2024-07-15T04:45:34 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
0 ms 348 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
int main() {
    int N;
    cin>>N;
    vector<long long> 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(B.begin(),B.end());
    vector<long long> min_strangeness(N+1,numeric_limits<long long>::max());
    for(int i=0; i<=N; ++i) {
        auto it=lower_bound(B.begin(),B.end(),A[i])-B.begin();
        if(it<N) {
            min_strangeness[i]=abs(A[i]-B[it]);
        }
        if(it>0) {
            min_strangeness[i]=min(min_strangeness[i],abs(A[i]-B[it-1]));
        }
    }
    for(int i=0; i<=N; ++i) {
        cout<<min_strangeness[i]<<" ";
    }
    cout<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -