Submission #716968

#TimeUsernameProblemLanguageResultExecution timeMemory
716968GitalCipele (COCI18_cipele)C++11
18 / 90
36 ms3156 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...