# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165554 | 2019-11-27T12:39:45 Z | muhi1112 | Cipele (COCI18_cipele) | C++17 | 60 ms | 4580 KB |
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define f1 first #define s2 second #define pb push_back #define mp make_pair #define ll long long #define fri(a) freopen(a,"r",stdin); #define fro(a) freopen(a,"w",stdout); const int N=405; ll n,m,a,ans,ans1,ans2; vector<ll>l,r,l1,r1; int main(){ //fri("in.txt"); //fro("out.txt"); cin>>n>>m; for(int i=0;i<n;i++){ scanf("%lld",&a); l.pb(a); l1.pb(a); } for(int i=0;i<m;i++){ scanf("%lld",&a); r.pb(a); r1.pb(a); } sort(l.begin(),l.end()); sort(r.begin(),r.end()); if(n<m){ for(int i=0;i<n;i++){ ans=max(ans,abs(l[i]-r[i])); } for(int i=0;i+n<=m;i++){ ans=min(ans,max(abs(l[0]-r[i]),abs(l[n-1]-r[i+n-1]))); } } else if(n>m){ for(int i=0;i<m;i++){ ans=max(ans,abs(l[i]-r[i])); } for(int i=0;i+m<=n;i++){ ans=min(ans,max(abs(l[i]-r[0]),abs(l[i+m-1]-r[m-1]))); } } else{ for(int i=0;i<n;i++){ ans=max(ans,abs(l[i]-r[i])); } } //cout<<"sa"<<endl; cout<<ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 4452 KB | Output is correct |
2 | Correct | 59 ms | 4580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 4452 KB | Output is correct |
2 | Correct | 60 ms | 4500 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 476 KB | Output is correct |
2 | Incorrect | 5 ms | 632 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 532 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 504 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 50 ms | 4068 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 54 ms | 4232 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 48 ms | 4196 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |