# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95004 |
2019-01-26T15:32:48 Z |
karlopuh |
Cipele (COCI18_cipele) |
C++14 |
|
95 ms |
1776 KB |
#include <bits/stdc++.h>
using namespace std;
vector<int> ljev;
vector<int> desn;
int uzmi;
int maks=-1;
int zamj=1e9+10;
int l,r;
int main(){
cin>>l>>r;
for(int i=0;i<l;i++){
int br;
cin>>br;
ljev.push_back(br);
}
for(int i=0;i<r;i++){
int br;
cin>>br;
desn.push_back(br);
}
sort(ljev.begin(),ljev.end());
sort(desn.begin(),desn.end());
if(l>r){
uzmi=ljev[0];
ljev.erase(ljev.begin());
for(int i=0;i<r;i++){
if(abs(ljev[i]-desn[i])>maks)maks=abs(ljev[i]-desn[i]);
if(abs(uzmi-desn[i])<maks){
if(abs(ljev[i]-desn[i])>zamj){
maks=zamj;
zamj=abs(ljev[i]-desn[i]);
}
else if(zamj==1e9+10){
zamj=ljev[i]-desn[i];
maks=abs(uzmi-desn[i]);
}
}
}
}
else if(r>l){
uzmi=desn[0];
desn.erase(desn.begin());
for(int i=0;i<l;i++){
if(abs(ljev[i]-desn[i])>maks)maks=abs(ljev[i]-desn[i]);
if(abs(uzmi-ljev[i])<maks){
if(abs(ljev[i]-desn[i])>zamj){
maks=zamj;
zamj=abs(ljev[i]-desn[i]);
}
else if(zamj==1e9+10){
zamj=ljev[i]-desn[i];
maks=abs(ljev[i]-uzmi);
}
}
}
}else{
for(int i=0;i<l;i++){
if(abs(ljev[i]-desn[i])>maks)maks=abs(ljev[i]-desn[i]);
}
}
cout<<maks;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
1776 KB |
Output is correct |
2 |
Correct |
95 ms |
1772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
1776 KB |
Output is correct |
2 |
Correct |
95 ms |
1712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
408 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
1608 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
1772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
1616 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |