답안 #361200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361200 2021-01-28T16:02:00 Z daringtrifles Cipele (COCI18_cipele) C++17
0 / 90
143 ms 40448 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define FOR(i, a, b) for (signed ll i = (signed ll)(a); i < (signed ll)(b); i++)
#define NEGFOR(i, a, b) for (ll i = (a); i > (b); i--)
#define vll vector<ll>
#define sll set<ll>
#define ld long double
#define inf 1000000000000000000
#define mll multiset<ll>
#define vpll vector<pll>
#define nn << "\n"
#define ss << " "
//10^8 operations per second
//greatest int is 2,147,483,647
//greates long long is 9.22337204e18
ll l, r;
mll le, ri;
bool check(ll n)
{
    mll x=le;
    mll y=ri;
    if (l > r)
    {
        swap(l, r);
        swap(x, y);
    }

    for (auto i:x){
        auto it=y.lower_bound(i);
        if (abs(*it-i)<=n){
            y.erase(it);
        }
        else return 0;
    }
    return 1;
    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> l >> r;

    FOR(i, 0, l)
    {
        ll a;
        cin >> a;
        le.insert(a);
    }
    FOR(i, 0, l)
    {
        ll a;
        cin >> a;
        ri.insert(a);
    }
    ll l=0, r=inf;

    while (l<r){
        ll mid=l+(r-l)/2;
        if (check(mid)){
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    cout<<(l+r)/2;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 101 ms 40044 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 143 ms 40448 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 876 KB Output is correct
2 Incorrect 46 ms 1388 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 1900 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1900 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 2304 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 93 ms 26860 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 121 ms 34156 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 91 ms 27372 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -