# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1039550 | 2024-07-31T04:21:26 Z | 변재우(#10994) | Sprinklers (CEOI24_sprinklers) | C++17 | 15 ms | 1116 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(i<=M && B[i]-A[j]<=k) i++; i--; } else { s+='L'; while(i<=M && 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 | 0 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 | 6 ms | 1116 KB | Correct |
3 | Correct | 0 ms | 348 KB | Correct |
4 | Correct | 7 ms | 1116 KB | Correct |
5 | Correct | 7 ms | 1116 KB | Correct |
6 | Correct | 0 ms | 348 KB | Correct |
7 | Correct | 0 ms | 348 KB | Correct |
8 | Correct | 2 ms | 604 KB | Correct |
9 | Correct | 0 ms | 348 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Correct |
2 | Correct | 9 ms | 1116 KB | Correct |
3 | Incorrect | 3 ms | 604 KB | User solution is incorrect |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Correct |
2 | Correct | 0 ms | 348 KB | Correct |
3 | Incorrect | 0 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 | 0 ms | 348 KB | Correct |
2 | Incorrect | 15 ms | 1116 KB | User solution is incorrect |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Correct |
2 | Correct | 0 ms | 348 KB | Correct |
3 | Correct | 6 ms | 1116 KB | Correct |
4 | Correct | 0 ms | 348 KB | Correct |
5 | Correct | 7 ms | 1116 KB | Correct |
6 | Correct | 7 ms | 1116 KB | Correct |
7 | Correct | 0 ms | 348 KB | Correct |
8 | Correct | 0 ms | 348 KB | Correct |
9 | Correct | 2 ms | 604 KB | Correct |
10 | Correct | 0 ms | 348 KB | Correct |
11 | Correct | 9 ms | 1116 KB | Correct |
12 | Incorrect | 3 ms | 604 KB | User solution is incorrect |
13 | Halted | 0 ms | 0 KB | - |