QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#311609 | #5572. Gridlandia | qsc114 | WA | 1ms | 3672kb | C++14 | 689b | 2024-01-22 15:54:29 | 2024-01-22 15:54:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e3+5;
char a[MAXN][MAXN];
void filln(int x,int len)
{
if(len<=0)return;
if(len==1)
{
a[x][x]='U';
return;
}
if(len==2)
{
a[x][x]='L';
a[x][x+1]='U';
a[x+1][x]='D';
a[x+1][x+1]='R';
return;
}
for(int i=x;i<x+len-1;i++)a[x][i]='L';
for(int i=x;i<x+len-1;i++)a[i][x+len-1]='U';
for(int i=x+1;i<=x+len-1;i++)a[x+len-1][i]='R';
for(int i=x+1;i<=x+len-1;i++)a[i][x]='D';
filln(x+2,len-4);
}
int main()
{
int n;cin>>n;
filln(1,n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(a[i][j]==0)cout<<'.';
else cout<<a[i][j];
}
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
1
output:
U
result:
ok answer = 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
2
output:
LU DR
result:
ok answer = 4
Test #3:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
3
output:
LLU D.U DRR
result:
ok answer = 8
Test #4:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
4
output:
LLLU D..U D..U DRRR
result:
ok answer = 12
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
5
output:
LLLLU D...U D.U.U D...U DRRRR
result:
wrong answer jury has the better answer: jans = 18, pans = 17