# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151306 | dfistric | Cipele (COCI18_cipele) | C++14 | 162 ms | 3368 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector < int >l; vector < int >d; vector < int >l2;
int main(){
int n,m; cin >> n >> m;
if(m>n){
swap(m,n);
}
for(int i=0; i<n; i++){
int br; cin >> br;
l.push_back(br);
}
for(int i=0; i<m; i++){
int br; cin >> br;
d.push_back(br);
}
sort(l.begin(),l.end()); sort(d.begin(),d.end());
int naj;
if (m==n){
naj=0;
for(int i=0; i<n; i++){
if (abs(l[i]-d[i])>naj){
naj=abs(l[i]-d[i]);
}
}
}
else{
naj=0;
for(int i=n-m; i<n; i++){
l2.push_back(l[i]);
}
for(int i=0; i<l2.size(); i++){
if (abs(d[i]-l2[i])>naj){
naj=abs(d[i]-l2[i]);
}
}
}
cout << naj; return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |