답안 #239092

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
239092 2020-06-14T11:05:01 Z ioilolcom Cipele (COCI18_cipele) C++14
0 / 90
91 ms 13560 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
set<int> s;
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n,m; cin>>n>>m;
	vector<int> v1(n+1),v2(m+1);
	for(int i=1; i<=n; i++) {
		cin>>v1[i];
	}
	for(int i=1; i<=m; i++) {
		cin>>v2[i];
	}
	if(m>n) {
		swap(n,m);
		swap(v1,v2);
	}

	for(int i=1; i<=n; i++) {
		s.insert(v1[i]);
	}
	//cout<<endl;
	sort(v2.rbegin(),v2.rend()-1);
	/*
	   for(int i=1; i<=m; i++) {
	        cout<<v2[i]<<" ";
	   }
	   cout<<endl;
	 */
	int ans=0;
	for(int i=1; i<=m; i++) {
		auto d=s.lower_bound(v2[i]);
		auto d2=d;
		d2--;
		if(abs(*d-v2[i])<abs(*d2-v2[i])) {
			ans=max(ans,abs(*d-v2[i]));
			s.erase(d);
		}
		else{
			ans=max(ans,abs(*d2-v2[i]));
			s.erase(d2);
		}
	}
	cout<<ans<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 7288 KB Output is correct
2 Runtime error 91 ms 13560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 86 ms 13432 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 512 KB Output is correct
2 Runtime error 8 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 512 KB Output is correct
2 Runtime error 10 ms 1408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 69 ms 6904 KB Output is correct
2 Runtime error 52 ms 8312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 78 ms 12408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 6776 KB Output isn't correct
2 Halted 0 ms 0 KB -