Submission #681748

#TimeUsernameProblemLanguageResultExecution timeMemory
681748penguin133Cipele (COCI18_cipele)C++17
90 / 90
38 ms3620 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif int n, m, L[100005], R[100005]; void solve(){ cin >> n >> m; for(int i=1;i<=n;i++)cin >> L[i]; for(int i=1;i<=m;i++)cin >> R[i]; sort(L+1, L+1+n); sort(R+1, R+1+m); int lo = 0, hi = 2e9, ans = hi + 1; while(lo <= hi){ int mid = (lo + hi) >> 1; int in = 1; bool die = 0; if(n < m){ for(int i=1;i<=n;i++){ while(in <= m && L[i] - R[in] > mid)in++; if(in == m + 1 || abs(L[i] - R[in]) > mid)die = 1; in++; } } else{ for(int i=1;i<=m;i++){ while(in <= n && R[i] - L[in] > mid)in++; if(in == n + 1 || abs(R[i] - L[in]) > mid)die = 1; in++; } } if(die)lo = mid + 1; else hi = mid - 1, ans = mid; } cout << ans; } main(){ ios::sync_with_stdio(0);cin.tie(0); int tc = 1; //cin >> tc; for(int tc1=1;tc1<=tc;tc1++){ // cout << "Case #" << tc1 << ": "; solve(); } }

Compilation message (stderr)

cipele.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   44 | main(){
      | ^~~~
#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...