# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1039549 | 2024-07-31T04:19:14 Z | 변재우(#10994) | Sprinklers (CEOI24_sprinklers) | C++17 | 14 ms | 2392 KB |
#include <bits/stdc++.h> #define int long long using namespace std; const int Nmax=100010; int N, M, ans=-1, A[Nmax], B[Nmax]; bool chk(int k, bool op) { string s; for(int i=1, j=1; i<=M; i++) { bool flag=false; while(j<=N && !flag) { flag|=(abs(B[i]-A[j])<=k); if(A[j]<=B[i]) { s+='R'; while(B[i]-A[j]<=k) i++; i--; } else { s+='L'; while(A[j]-B[i]>=0) i++; i--; } j++; } if(!flag) return false; } while(s.size()<N) s+='L'; if(op) cout<<s; return true; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>N>>M; for(int i=1; i<=N; i++) cin>>A[i]; for(int i=1; i<=M; i++) cin>>B[i]; for(int s=0, e=1e9; s<=e; ) { int mid=(s+e)/2; if(chk(mid, false)) ans=mid, e=mid-1; else s=mid+1; } cout<<ans<<"\n"; chk(ans, true); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Correct |
2 | Correct | 0 ms | 348 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Correct |
2 | Correct | 8 ms | 1884 KB | Correct |
3 | Correct | 4 ms | 348 KB | Correct |
4 | Correct | 11 ms | 2136 KB | Correct |
5 | Correct | 8 ms | 2208 KB | Correct |
6 | Correct | 2 ms | 348 KB | Correct |
7 | Correct | 3 ms | 348 KB | Correct |
8 | Correct | 2 ms | 604 KB | Correct |
9 | Correct | 4 ms | 348 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Correct |
2 | Correct | 11 ms | 2140 KB | Correct |
3 | Incorrect | 6 ms | 604 KB | User solution is incorrect |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Correct |
2 | Correct | 0 ms | 348 KB | Correct |
3 | Incorrect | 3 ms | 344 KB | User solution is worse than jury's solution |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Correct |
2 | Incorrect | 14 ms | 2392 KB | User solution is incorrect |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 348 KB | Correct |
2 | Correct | 0 ms | 348 KB | Correct |
3 | Correct | 8 ms | 1884 KB | Correct |
4 | Correct | 4 ms | 348 KB | Correct |
5 | Correct | 11 ms | 2136 KB | Correct |
6 | Correct | 8 ms | 2208 KB | Correct |
7 | Correct | 2 ms | 348 KB | Correct |
8 | Correct | 3 ms | 348 KB | Correct |
9 | Correct | 2 ms | 604 KB | Correct |
10 | Correct | 4 ms | 348 KB | Correct |
11 | Correct | 11 ms | 2140 KB | Correct |
12 | Incorrect | 6 ms | 604 KB | User solution is incorrect |
13 | Halted | 0 ms | 0 KB | - |