Submission #919621

# Submission time Handle Problem Language Result Execution time Memory
919621 2024-02-01T09:08:30 Z mariamp1 Cipele (COCI18_cipele) C++14
0 / 90
66 ms 2896 KB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 1e5 + 5;
int n, m;
vector<int> a(N);
vector<int> b(N);
bool check(int x) {
    int tmp = 1;
    for (int i = 1; i <= n; i++) {
        while (tmp <= m && a[i] - x > b[tmp]) tmp++;
        if (tmp == m + 1 || a[i] + x < b[tmp]) return false;
        tmp++;
    }
    return true;
}
int main(){
    int n, m; cin >> n >> m;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= m; i++){
        cin >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int l = 0, h = 1e9, ans = 0;
    while(l <= h){
        int mid = (l+h)/2;
        if(check(mid)){
            ans = mid;
            h = mid-1;
        }
        else l = mid + 1;
    }
    cout << ans << endl;
}

# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 2896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1112 KB Output is correct
2 Incorrect 8 ms 1112 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1264 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 2660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 2724 KB Output isn't correct
2 Halted 0 ms 0 KB -