Submission #779168

# Submission time Handle Problem Language Result Execution time Memory
779168 2023-07-11T08:37:46 Z vjudge1 Cipele (COCI18_cipele) C++17
18 / 90
804 ms 6368 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define OYY 1000000005
#define mod 998244353
vector <int> v,t;

int32_t main(){
    faster
    int n,m;cin>>n>>m;
    int deg;
    for(int i=0;i<n;i++){
        cin>>deg;
        v.push_back(deg);
    }
    for(int i=0;i<m;i++){
        cin>>deg;
        t.push_back(deg);
    }
   // v.push_back(0),t.push_back(0);
    sort(v.begin(),v.end());
    sort(t.begin(),t.end());
    v.push_back(OYY),t.push_back(OYY);
    if(m<n){
        swap(v,t);
        swap(n,m);
    }
    int maxi=0;
    for(int i=0;i<n;i++){
        int c=lower_bound(t.begin(),t.end(),v[i])-t.begin();
        if(c-1>=1){
        int deg=t[c-1];
        //cout<<t[c]<<" "<<deg<<endl;
        if(abs(t[c]-v[i])>abs(deg-v[i])){
            maxi=max(maxi,abs(deg-v[i]));
            t.erase(t.begin()+c-1);
            continue;
        }
        maxi=max(maxi,abs(t[c]-v[i]));
        t.erase(t.begin()+c);
        }
        else{
            maxi=max(maxi,abs(t[c]-v[i]));
            t.erase(t.begin()+c);
        }
    }
    cout<<maxi<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 786 ms 4144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 804 ms 6368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 482 ms 3780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 616 ms 6336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 480 ms 6328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -