Submission #560210

#TimeUsernameProblemLanguageResultExecution timeMemory
560210AGECipele (COCI18_cipele)C++14
0 / 90
859 ms8320 KiB
#include<bits/stdc++.h> #define F first #define S second #define pb push_back #define int long long using namespace std; const int N=1e5+5,M=2e3+10,mod=100000000000031; vector<int>v; long long summ(long long x,long long y){ return ((x%mod)+(y%mod))%mod; } long long mult(long long x,long long y){ return ((x%mod)*(y%mod))%mod; } int n,m,a[N],b[N]; bool ok(int mid){ set<int>st; for(int i=0;i<n;i++) st.insert(-a[i]); int i=0,okk=0; while(i<m){ while(st.size()!=0&&abs(b[i]-abs(*st.begin()))>mid) st.erase(st.begin()); if(st.size()==0){ okk=1; break; } i++; st.erase(st.begin()); } return !okk; } main() { cin>>n>>m; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<m;i++) cin>>b[i]; sort(b,b+m); reverse(b,b+m); int l=0,r=1e9; while(l<r){ int mid=(l+r)/2; if(ok(mid)) r=mid; else l=mid+1; } cout<<r<<endl; return 0; }

Compilation message (stderr)

cipele.cpp:45:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   45 | 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...