# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150953 | 2019-09-01T12:56:12 Z | PedroBigMan | Cipele (COCI18_cipele) | C++14 | 54 ms | 3824 KB |
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF ((ll) pow(2,63) -1) ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} vector<ll> a,b; ll N,M; ll Check(ll K) { ll it=0; ll cur=0; while(cur<N) { while(it<M && abs(b[it]-a[cur])>K) {it++;} if(it==M) {return false;} it++; cur++; } return true; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>N>>M; if(N<=M) {In(a,N); In(b,M);} else {In(b,N); In(a,M);} ll x=N; ll y=M; N=min(x,y); M=max(x,y); sort(a.begin(),a.end()); sort(b.begin(),b.end()); ll hi=pow(10,9) +1; ll lo=0; ll mid; while(hi>lo) { mid = (hi+lo)/2; if(Check(mid)) {hi=mid;} else {lo=mid+1;} } cout<<lo<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 3696 KB | Output is correct |
2 | Correct | 54 ms | 3700 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 3824 KB | Output is correct |
2 | Correct | 54 ms | 3820 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 504 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 504 KB | Output is correct |
2 | Correct | 4 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 492 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 504 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 3412 KB | Output is correct |
2 | Correct | 34 ms | 2652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 3564 KB | Output is correct |
2 | Correct | 28 ms | 3124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 3440 KB | Output is correct |
2 | Correct | 47 ms | 3696 KB | Output is correct |