QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#606626 | #6431. Oops, It's Yesterday Twice More | S_zhi# | WA | 0ms | 3716kb | C++14 | 928b | 2024-10-03 11:03:30 | 2024-10-03 11:03:35 |
Judging History
answer
#include <iostream>
using namespace std ;
int main(){
int n , a , b ; cin >> n >> a >> b ;
/*
U
L R
D
*/
int ansx = 1 , ansy = 1 ;
if((a - 1) + (b - 1) <= n - 1){
ansx = 1 , ansy = 1 ;
for(int i = 1 ; i < n ; i ++ ) cout << "UL" ;
}else if((a - 1) + (n - b) <= n - 1){
ansx = 1 , ansy = n ;
for(int i = 1 ; i < n ; i ++ ) cout << "DL" ;
}else if((n - a) + (b - 1) <= n - 1){
ansx = n , ansy = 1 ;
for(int i = 1 ; i < n ; i ++ ) cout << "UR" ;
}else{
ansx = n , ansy = n ;
for(int i = 1 ; i < n ; i ++ ) cout << "DR" ;
}
while(ansx != a){
if(ansx < a) ansx ++ , cout << "R" ;
else ansx -- , cout << "L" ;
}
while(ansy != b){
if(ansy < b) ansy ++ , cout << "D" ;
else ansy -- , cout << "R" ;
}
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
input:
3 3 3
output:
DLDLRR
result:
ok n=3, x=3, y=3
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
4 3 2
output:
ULULULRRD
result:
wrong answer Failed