QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#747889 | #4771. Bird tree | gyydp123_LIM | AC ✓ | 1ms | 3716kb | C++20 | 1.1kb | 2024-11-14 18:37:02 | 2024-11-14 18:37:02 |
Judging History
answer
//Start: 2024-11-14 18:34:15
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=(j);i<=(k);++i)
#define ForDown(i,j,k) for(int i=(j);i>=(k);--i)
#define Debug(fmt, args...) fprintf(stderr,"(func %s, line #%d): " fmt, __func__, __LINE__, ##args),fflush(stderr)
#define debug(fmt, args...) fprintf(stderr,fmt,##args),fflush(stderr)
#define within :
#define LJY main
using namespace std;
typedef long long ll;
const int N=1e5+5;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
inline int read(){
char ch=getchar();int x=0,f=1;
while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
while(ch>='0'&&ch<='9')
x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return x*f;
}
ll a,b;bool ans[N];int tot;
void solve(int la,int lb,int A,int B,int ra,int rb){
if(A==a&&b==B) return;
if(a*B<=b*A) ans[++tot]=0,solve(la,lb,la+A,lb+B,A,B);
else ans[++tot]=1,solve(A,B,A+ra,B+rb,ra,rb);
}
void ljy(){
a=read(),b=read();
tot=0;solve(0,1,1,1,1,0);
for(int i=2;i<=tot;i+=2) ans[i]=ans[i]^1;
For(i,1,tot) putchar(ans[i]?'R':'L');puts("");
}
signed LJY(){int T=read();while(T--) ljy();}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
input:
3 1/2 2/5 7/3
output:
L LRR RLLR
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
96 1/2 1/3 1/4 1/5 1/6 1/7 1/8 2/1 2/3 2/5 2/7 3/1 3/2 3/4 3/5 3/7 3/8 4/1 4/3 4/5 4/7 5/1 5/2 5/3 5/4 5/6 5/7 5/8 6/1 6/5 6/7 7/1 7/2 7/3 7/4 7/5 7/6 7/8 8/1 8/3 8/5 8/7 10000/9999 9999/10000 1/10000 10000/1 1000000000/300001 300001/1000000000 701408733/433494437 433494437/701408733 380211999/53852...
output:
L LR LRL LRLR LRLRL LRLRLR LRLRLRL R LL LRR LRLL RL RR LLR LLL LRRL LRRR RLR RRL LLRL LLLR RLRL RLL RRR RRLR LLRLR LLRR LLLL RLRLR RRLRL LLRLRL RLRLRL RLRR RLLR RRRL RRLL RRLRLR LLRLRLR RLRLRLR RLLL RRRR RRLRLRL RRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...
result:
ok 96 lines