# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1270429 | SmuggingSpun | Cipele (COCI18_cipele) | C++20 | 32 ms | 1096 KiB |
#include<bits/stdc++.h>
#define taskname "C"
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
int n, m;
cin >> n >> m;
vector<int>l(n), r(m);
for(int& x : l){
cin >> x;
}
for(int& x : r){
cin >> x;
}
if(n > m){
swap(n, m);
swap(l, r);
}
sort(l.begin(), l.end());
sort(r.begin(), r.end());
int low = 0, high = 1e9, ans;
while(low <= high){
int mid = (low + high) >> 1;
bool f = true;
for(int i = 0, j = 0; i < n; i++){
while(j < m && l[i] - r[j] > mid){
j++;
}
if(j == m || l[i] - r[j] < -mid){
f = false;
break;
}
j++;
}
if(f){
high = (ans = mid) - 1;
}
else{
low = mid + 1;
}
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |