제출 #240205

#제출 시각아이디문제언어결과실행 시간메모리
240205hzhuarryCipele (COCI18_cipele)C++17
72 / 90
62 ms3240 KiB
#include <bits/stdc++.h> #include <fstream> using namespace std; #define endl "\n" #define pf push_front #define pb(s) push_back(s) #define mp(a,b) make_pair(a,b) #define f first #define s second #define ALL(v) v.begin(), v.end() #define ALLA(arr, sz) arr, arr + sz #define SORT(v) sort(ALL(v)) #define REVERSE(v) reverse(ALL(v)) #define SORTA(arr, sz) sort(ALLA(arr, sz)) #define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) #define PI 3.14159265358979323846264338327950L #define lb lower_bound #define ub upper_bound typedef long long ll; typedef long double ld; typedef string str; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ld,ld> pld; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<char> vc; typedef vector<str> vs; typedef vector<ld> vd; typedef vector<str> vs; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<pld> vpd; const int MOD = 1000000007; const int dx[4]= {-1,1,0,0}, dy[4]= {0,0,-1,1}; //flood int N,M; vi l,r; bool ok(int ugly) { int cnt=0,j=0; for(int i=0;i<N&&j<M;++i) { int curr=l[i]; while(j<M&&abs(r[j]-curr)>ugly)++j; cnt++; ++j; } return cnt>=N; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); //ifstream cin (".in"); //ofstream cout (".out"); cin>>N>>M; for(int i=0;i<N;++i){ int a; cin>>a; l.pb(a); } for(int i=0;i<M;++i) { int b; cin>>b; r.pb(b); } if(N>M) { swap(l,r); swap(N, M); } SORT(l); SORT(r); int lo=0,hi=1e9; while(lo<hi) { int mid=(lo+hi)/2; if(ok(mid)){ hi=mid; } else{ lo=mid+1; } } cout<<lo<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...