Submission #1023816

# Submission time Handle Problem Language Result Execution time Memory
1023816 2024-07-15T06:53:33 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int n;
    cin >> n;
    
    vector<int> a(n + 1), b(n);
    
    for (int i = 0; i < n + 1; i++) {
        cin >> a[i];
    }
    
    for (int j = 0; j < n; j++) {
        cin >> b[j];
    }
    
    sort(b.begin(), b.end());
    
    vector<int> ans;
    
    for (int i = 0; i < n + 1; i++) {
        vector <int> v;
        for(int j = 0 ; j < n + 1; j++){
            if(i == j){
                continue;
            }
            else{
                v.push_back(a[j]);
            }
        }
        
        sort(v.begin() , v.end());
        
        int mn = 0;
        for(int j = 0 ; j < n; j++){
            mn = max(mn , abs(v[j] - b[j]));
        }
        ans.push_back(mn);
    }
    
    for(auto x : ans){
        cout << x << " ";
    }
    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -