#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
long long int s[n];
long long int f[m];
for(int i = 0; i < n; i++){
cin >> s[i];
}
long long int ans = -1;
for(int i = 0; i < m; i++){
cin >> f[i];
int ans1 = -1;
int l = 0;
int r = n - 1;
while(l <= r){
int mid = (l + r) / 2;
if(s[mid] <= f[i]){
ans1 = max(ans1, mid);
l = mid + 1;
}else{
r = mid - 1;
}
}
long long int mini = 1e18;
if(ans1 != -1){
mini = f[i] - s[ans1];
}
int ans2 = n + 1;
l = 0;
r = n - 1;
while(l <= r){
int mid = (l + r) / 2;
if(s[mid] >= f[i]){
ans2 = min(ans2, mid);
r = mid - 1;
}else{
l = mid + 1;
}
}
if(ans2 != (n + 1)){
mini = min(mini, s[ans2] - f[i]);
}
ans = max(ans, mini);
}
cout << ans << endl;
for(int i = 0; i < n; i++){
if(i % 3 == 0 or i % 3 == 2){
cout << "R";
}else{
cout << "L";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
User solution is incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
User solution is incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
26 ms |
1112 KB |
Correct |
3 |
Correct |
4 ms |
348 KB |
Correct |
4 |
Correct |
59 ms |
1968 KB |
Correct |
5 |
Correct |
58 ms |
1972 KB |
Correct |
6 |
Correct |
0 ms |
344 KB |
Correct |
7 |
Correct |
1 ms |
348 KB |
Correct |
8 |
Correct |
52 ms |
1984 KB |
Correct |
9 |
Correct |
56 ms |
1884 KB |
Correct |
10 |
Correct |
58 ms |
1884 KB |
Correct |
11 |
Correct |
28 ms |
1116 KB |
Correct |
12 |
Correct |
36 ms |
1428 KB |
Correct |
13 |
Correct |
35 ms |
1628 KB |
Correct |
14 |
Correct |
40 ms |
1792 KB |
Correct |
15 |
Correct |
43 ms |
1876 KB |
Correct |
16 |
Correct |
34 ms |
1624 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
User solution is incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
31 ms |
1112 KB |
User solution is incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
344 KB |
User solution is incorrect |
3 |
Halted |
0 ms |
0 KB |
- |