# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472276 |
2021-09-13T10:55:43 Z |
_L__ |
Cipele (COCI18_cipele) |
C++17 |
|
1000 ms |
1100 KB |
// This code is written by _L__
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update>;
#define endl '\n'
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7, N = 1e5+300, INF = 1e18;
const ld E = 1e-6;
int main(void){
F_word;
int n, m; cin >> n >> m;
vector<int> l(n), r(m); for(int i = 0; i < n; ++i) cin >> l[i]; for(int i =0 ; i < m; ++i) cin >> r[i];
sort(l.begin(), l.end());
sort(r.begin(), r.end());
if(n <= m){
ll ans = 0;
for(int i = 0; i < n; ++i){
ll idx = 0, b = INT_MAX;
for(int j = 0; j < r.size(); ++j){
if(abs(r[j]-l[i]) <= b){
b = abs(r[j]-l[i]);
idx = j;
}
}
r.erase(r.begin()+idx);
ans = max(ans, b);
}
cout << ans << endl;
} else {
ll ans = 0;
for(int i = 0; i < m; ++i){
ll idx = 0, b = INT_MAX;
for(int j =0;j < l.size(); ++j){
if(abs(l[j]-r[i]) <= b){
idx = j;
b = abs(r[i]-l[j]);
}
}
l.erase(l.begin()+idx);
ans = max(ans, b);
}
cout << ans << endl;
}
}
Compilation message
cipele.cpp: In function 'int main()':
cipele.cpp:25:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int j = 0; j < r.size(); ++j){
| ~~^~~~~~~~~~
cipele.cpp:39:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | for(int j =0;j < l.size(); ++j){
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
1100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1071 ms |
1100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
332 KB |
Output is correct |
2 |
Correct |
18 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
18 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |