Submission #779173

# Submission time Handle Problem Language Result Execution time Memory
779173 2023-07-11T08:40:39 Z vjudge1 Cipele (COCI18_cipele) C++17
18 / 90
815 ms 6364 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>=0){
            int deg=t[c-1];
            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 Correct 815 ms 2640 KB Output is correct
2 Runtime error 770 ms 6364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 806 ms 4832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 4 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 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 476 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 615 ms 4792 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 463 ms 4832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -