Submission #85074

# Submission time Handle Problem Language Result Execution time Memory
85074 2018-11-18T11:59:29 Z Linst90 Cipele (COCI18_cipele) C++11
27 / 90
130 ms 10152 KB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace::std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> f;
    vector<int> s;
    if(n>m){
        for(int i=0,t;i<n;i++)
            cin>>t,s.push_back(t);
        for(int i=0,t;i<m;i++)
            cin>>t,f.push_back(t);
        swap(n,m);
    }else{
        for(int i=0,t;i<n;i++)
            cin>>t,f.push_back(t);
        for(int i=0,t;i<m;i++)
            cin>>t,s.push_back(t);
    }
    sort(f.begin(),f.end(),greater_equal<int>());
    sort(s.begin(),s.end(),greater_equal<int>());

    int pos=0;
    for(int i=1;i<m-n+1;i++){
        if(abs(f[0]-s[i])<=abs(f[0]-s[pos])) pos=i;
    }
    int maxn=0;
    for(int i=pos,t=pos;i<pos+n;i++)
        maxn=max(abs(f[i-t]-s[i]),maxn);//,cout<<abs(f[i-t]-s[i])<<' '<<i-t<<' '<<i<<'\n';
    cout<<maxn<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 92 ms 3056 KB Output is correct
2 Correct 120 ms 4848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 6588 KB Output is correct
2 Correct 116 ms 8296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8296 KB Output is correct
2 Correct 7 ms 8296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 8296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 8296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 8296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 8296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 8352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 8644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 10152 KB Output isn't correct
2 Halted 0 ms 0 KB -