Submission #1090922

# Submission time Handle Problem Language Result Execution time Memory
1090922 2024-09-19T07:25:27 Z LucaIlie Cipele (COCI18_cipele) C++17
0 / 90
71 ms 3832 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 3e5;
const int MAX_K = 1e9;
int f[MAX_N], b[MAX_N];

int main() {
    int n, m;

    cin >> n >> m;
    for ( int i = 0; i < n; i++ )
        cin >> f[i];
    sort( f, f + n );
    for ( int i = 0; i < m; i++ )
        cin >> b[i];
    sort( b, b + m );

    if ( n > m ) {
        swap( n, m );
        swap( f, b );
    }

    int st = -1, dr = MAX_K;
    while ( dr - st > 1 ) {
        int k = (st + dr) / 2;

        int i = 0, j = 0;
        while ( i < n && j < m ) {
            if ( f[i] < b[j] ) {
                if ( b[j] - f[i] <= k )
                    j++;
                i++;
            } else {
                if ( f[i] - b[j] <= k )
                    i++;
                j++;
            }
        }

        if ( i == n )
            dr = k;
        else
            st = k;
    }

    cout << dr << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 2740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 2916 KB Output is correct
2 Incorrect 68 ms 2988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Incorrect 4 ms 356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 65 ms 2700 KB Output is correct
2 Incorrect 43 ms 3832 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 2232 KB Output isn't correct
2 Halted 0 ms 0 KB -