Submission #699350

# Submission time Handle Problem Language Result Execution time Memory
699350 2023-02-16T15:51:18 Z Uniq0rn Cipele (COCI18_cipele) C++17
0 / 90
43 ms 2904 KB
#include <bits/stdc++.h> 
using namespace std; 
 
#define ll long long int 
#define ld long double
#define vi(x)  vector<x>
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
 
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
int main()
{
    cin.tie(nullptr)->ios_base::sync_with_stdio(false);
    int n,m;cin >> n >> m;
    vector<int> a(n),b(m);
    for(auto &e:a) cin >> e;
    for(auto &e:b) cin >> e;
    sort(all(a),greater<int>());sort(all(b),greater<int>());
    if(n>m){
        swap(a,b);
        swap(n,m);
    }
    int l = 0,r = 1e9+10;
    while(l < r){
        int mid = (l+r)>>1;
        int p = 0,ok = 0;
        for(int i=0;i<n;i++){
            while(p<m && abs(a[i]-b[p]) > mid) p++;
            if(p<m && abs(a[i]-b[p]) <= mid) ok = 1;
        }
        if(ok){
            r = mid;
        }
        else{
            l = mid+1;
        }
    }
    cout << r;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 2904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 2 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 2412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 2360 KB Output isn't correct
2 Halted 0 ms 0 KB -