Submission #75090147
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int t,n,a,b;
int main(){
cin>>t;
while(t--){
cin>>n>>a>>b;
if((a-1)%2&&(n-b)%2&&b%2||a%2&&(b-1)%2&&(n-b-1)%2){
cout<<"Yes\n";
if(a%2){
for(int i=1;i<a;i+=2){
for(int j=1;j<n;j++) cout<<"R";cout<<"D";
for(int j=1;j<n;j++) cout<<"L";cout<<"D";
}
for(int i=3;i<b;i+=2) cout<<"DRUR";
cout<<"DR";
for(int i=b;i<n;i+=2) cout<<"RURD";
for(int i=a+2;i<=n;i++){
cout<<"D";for(int j=1;j<n;j++) cout<<"L";
cout<<"D";for(int j=1;j<n;j++) cout<<"R";
}
cout<<"\n";
}
else{
for(int i=1;i<a;i+=2){
for(int j=1;j<n;j++) cout<<"R";cout<<"D";
for(int j=1;j<n;j++) cout<<"L";cout<<"D";
}
for(int i=1;i<n;i++) cout<<"R";cout<<"D";
for(int i=n-2;i>b;i-=2) cout<<"DLUL";
cout<<"DL";
for(int i=b;i>1;i-=2) cout<<"LULD";
for(int i=a+2;i<=n;i++){
cout<<"D";for(int j=1;j<n;j++) cout<<"R";
cout<<"D";for(int j=1;j<n;j++) cout<<"L";
}
cout<<"D";for(int i=1;i<n;i++) cout<<"R";
cout<<"\n";
}
}
else cout<<"No\n";
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - LRUD Moving |
| User | Rya_ |
| Language | C++23 (GCC 15.2.0) |
| Score | 0 |
| Code Size | 1113 Byte |
| Status | WA |
| Exec Time | 28 ms |
| Memory | 3608 KiB |
Compile Error
./Main.cpp: In function 'int main()':
./Main.cpp:8:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
8 | if((a-1)%2&&(n-b)%2&&b%2||a%2&&(b-1)%2&&(n-b-1)%2){
| ~~~~~~~~~~~~~~~~^~~~~
./Main.cpp:12:41: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
12 | for(int j=1;j<n;j++) cout<<"R";cout<<"D";
| ^~~
./Main.cpp:12:72: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
12 | for(int j=1;j<n;j++) cout<<"R";cout<<"D";
| ^~~~
./Main.cpp:13:41: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
13 | for(int j=1;j<n;j++) cout<<"L";cout<<"D";
| ^~~
./Main.cpp:13:72: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
13 | for(int j=1;j<n;j++) cout<<"L";cout<<"D";
| ^~~~
./Main.cpp:26:41: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
26 | for(int j=1;j<n;j++) cout<<"R";cout<<"D";
| ^~~
./Main.cpp:26:72: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
26 | for(int j=1;j<n;j++) cout<<"R";cout<<"D";
| ^~~~
./Main.cpp:27:41: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
27 | for(int j=1;j<n;j++) cout<<"L";cout<<"D";
| ^~~
./Main.cpp:27:72: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
27 | for(int j=1;j<n;j++) cout<<"L";cout<<"D";
| ^~~~
./Main.cpp:29:33: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
29 | for(int i=1;i<n;i++) cout<<"R";cout<<"D";
| ^~~
./Main.cpp:29:64: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
29 | for(int i=1;i<n;i++) cout<<"R";cout<<"D";
| ^~~~
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 450 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3540 KiB |
| 01_handmade_00.txt | WA | 28 ms | 3564 KiB |
| 01_handmade_01.txt | WA | 14 ms | 3380 KiB |
| 01_handmade_02.txt | AC | 14 ms | 3600 KiB |
| 01_handmade_03.txt | WA | 28 ms | 3568 KiB |
| 01_handmade_04.txt | WA | 14 ms | 3500 KiB |
| 01_handmade_05.txt | WA | 21 ms | 3596 KiB |
| 01_handmade_06.txt | WA | 21 ms | 3380 KiB |
| 01_handmade_07.txt | WA | 27 ms | 3532 KiB |
| 01_handmade_08.txt | WA | 21 ms | 3608 KiB |
| 01_handmade_09.txt | AC | 1 ms | 3532 KiB |
| 01_handmade_10.txt | WA | 8 ms | 3380 KiB |
| 01_handmade_11.txt | WA | 9 ms | 3380 KiB |
| 01_handmade_12.txt | WA | 11 ms | 3452 KiB |
| 01_handmade_13.txt | WA | 11 ms | 3448 KiB |
| 01_handmade_14.txt | WA | 11 ms | 3436 KiB |
| 01_handmade_15.txt | WA | 11 ms | 3488 KiB |
| 02_random_00.txt | WA | 21 ms | 3488 KiB |
| 02_random_01.txt | WA | 25 ms | 3532 KiB |
| 02_random_02.txt | WA | 20 ms | 3500 KiB |
| 02_random_03.txt | WA | 16 ms | 3608 KiB |
| 02_random_04.txt | WA | 25 ms | 3532 KiB |
| 02_random_05.txt | WA | 21 ms | 3436 KiB |
| 02_random_06.txt | WA | 21 ms | 3492 KiB |
| 02_random_07.txt | AC | 1 ms | 3500 KiB |
| 02_random_08.txt | AC | 1 ms | 3532 KiB |
| 02_random_09.txt | AC | 1 ms | 3508 KiB |
| 02_random_10.txt | AC | 1 ms | 3532 KiB |
| 02_random_11.txt | AC | 1 ms | 3548 KiB |
| 02_random_12.txt | AC | 1 ms | 3380 KiB |