Submission #1113777

#TimeUsernameProblemLanguageResultExecution timeMemory
1113777EfeBabagilSprinklers (CEOI24_sprinklers)C++14
9 / 100
61 ms4028 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n,m; cin>>n>>m; vector<int> spr(n),flo(m); for(int i=0;i<n;i++) { cin>>spr[i]; } int mn=LLONG_MAX; int mx=0; for(int i=0;i<m;i++) { cin>>flo[i]; mn=min(mn,flo[i]); mx=max(mx,flo[i]); } if(spr[0]>=mx&&n==1) { cout<<spr[0]-mn; cout<<endl; cout<<"L"; } else if(spr[0]<=mn&&n==1) { cout<<mx-spr[0]; cout<<endl; cout<<"R"; } else if(n==1){ cout<<"-1"; return 0; } if(n==1) return 0; int dif=0; for(int i=0;i<m;i++) { auto it= lower_bound(spr.begin(),spr.end(),flo[i]); if(*it==flo[i]) continue; int temp1=LLONG_MAX; int temp2=LLONG_MAX; if(it!=spr.end()){ temp1=abs(*it-flo[i]); } if(it!=spr.begin()) { int x=it-spr.begin(); x--; temp2 =abs(spr[x]-flo[i]); } dif=max(dif,min(temp2,temp1)); } cout<<dif<<endl; for(int i=0;i<n;i++) { if(i%3) cout<<"R"; else cout<<"L"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...