Submission #716968

# Submission time Handle Problem Language Result Execution time Memory
716968 2023-03-31T14:24:50 Z Gital Cipele (COCI18_cipele) C++11
18 / 90
36 ms 3156 KB
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int L,R; cin >> L >> R;
    vector<int> LL;
    vector<int> RR;
    for(int i = 1; i <= L; i++) {
        int x; cin >> x;
        LL.push_back(x);
    }
    for(int i = 1; i <= R; i++) {
        int x; cin >> x;
        RR.push_back(x);
    }
    sort(LL.begin(),LL.end());
    sort(RR.begin(),RR.end());
    int Max = INT_MIN;
    if(L > R) {
        int leftptr = 0;
        for(int i = 0; i < R; i++) {
            while(abs(RR[i] - LL[leftptr]) > abs(RR[i] - LL[leftptr + 1])) leftptr++;
            Max = max(Max,abs(RR[i] - LL[leftptr]));
        }
    }
    else if(R > L) {
        int leftptr = 0;
        for(int i = 0; i < L; i++) {
            while(abs(LL[i] - RR[leftptr]) > abs(LL[i] - RR[leftptr + 1])) leftptr++;
            Max = max(Max,abs(LL[i] - RR[leftptr]));
        }
    }
    else {
        for(int i = 0; i < L; i++) {
            Max = max(Max,abs(LL[i] - RR[i]));
        }
    }
    cout << Max;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 22 ms 2900 KB Output is correct
2 Correct 34 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 3012 KB Output is correct
2 Correct 34 ms 3152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 2 ms 496 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 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2764 KB Output isn't correct
2 Halted 0 ms 0 KB -