Submission #158757

#TimeUsernameProblemLanguageResultExecution timeMemory
158757InfiniteJestCipele (COCI18_cipele)C++14
0 / 90
1075 ms1272 KiB
#include <iostream> #include <fstream> #include <vector> #include <queue> #include <algorithm> #include <math.h> #include <map> #include <set> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ifstream in("input.txt"); ofstream out("output.txt"); typedef long long ll; int n,m; int va[100001]; int vb[100001]; deque<pair<int,int> > p; int main(){ cin>>n>>m; for(int i=0;i<n;i++)cin>>va[i]; for(int i=0;i<m;i++)cin>>vb[i]; sort(va,va+n); sort(vb,vb+m); if(n<m){ swap(va,vb); swap(n,m); } int minn=1e9+4; int mas=-1; /*for(int i=0;i<=n-m;i++){ while(!p.empty()&&p.front().fi<abs(va[i]-vb[i]))p.pop_front(); p.push_front(abs(va[i]-vb[i])); int mas=-1; for(int y=0;y<m;y++){ mas=max(mas,abs(va[i+y]-vb[y])); } minn=min(minn,mas); }*/ int ind=0; for(int i=0;i<m;i++){ int minp=1e9+4; int indp; for(int y=ind;y<=n-(m-i);y++){ if(abs(va[y]-vb[i])<minp){ minp=abs(va[y]-vb[i]); indp=y+1; } } mas=max(mas,minp); } cout<<mas; /*minn=min(minn,p.back().fi); for(int i=0;i<va.size();i++){ if(!p.empty()&&p.back().se==i-vb.size())p.pop_back(); while(p.front().fi<abs()) }*/ //cout<<minn; }

Compilation message (stderr)

cipele.cpp: In function 'int main()':
cipele.cpp:49:9: warning: variable 'indp' set but not used [-Wunused-but-set-variable]
     int indp;
         ^~~~
cipele.cpp:35:7: warning: unused variable 'minn' [-Wunused-variable]
   int minn=1e9+4;
       ^~~~
#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...