QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#142072 | #5572. Gridlandia | ammardab3an# | WA | 1ms | 3544kb | C++20 | 1.3kb | 2023-08-18 13:46:30 | 2023-08-18 13:46:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
int n;
cin >> n;
vector<string> grid(n, string(n, '.'));
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++){
if(((i+1)/2 + j)%2 == 0){
grid[i][j] = 'D';
}
}
if(n%2==0){
for(int i = 0; i < n; i += 2){
if((i/2)%2==0){
assert(grid[i][n-1]=='.');
grid[i][n-1] = 'R';
}
else{
assert(grid[i][0]=='.');
grid[i][0] = 'L';
}
}
}
else {
if(n >= 5) for(int i = 5; i < n; i+=4){
assert(grid[i][0]=='.');
assert(grid[i][n-1]=='.');
grid[i][0]='L';
grid[i][n-1] = 'R';
}
if(n >= 2) for(auto i : {2}){
assert(grid[i][0]=='.');
assert(grid[i][n-1]=='.');
grid[i][0]='L';
grid[i][n-1] = 'R';
}
}
for(int i = 0; i < n; i++) if(grid[0][i]=='D'){
grid[0][i] = 'U';
if(n >= 2){
assert(grid[1][i] == '.');
grid[1][i] = 'U';
}
}
for(int i = 0; i < n; i++){
cout << grid[i] << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3544kb
input:
1
output:
U
result:
ok answer = 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
2
output:
UR UD
result:
ok answer = 4
Test #3:
score: 0
Accepted
time: 1ms
memory: 3468kb
input:
3
output:
U.U UDU LDR
result:
ok answer = 8
Test #4:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
4
output:
U.UR UDUD LD.D D.D.
result:
ok answer = 12
Test #5:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
5
output:
U.U.U UDUDU LD.DR D.D.D D.D.D
result:
ok answer = 18
Test #6:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
6
output:
U.U.UR UDUDUD LD.D.D D.D.D. D.D.DR .D.D.D
result:
ok answer = 24
Test #7:
score: -100
Wrong Answer
time: 1ms
memory: 3496kb
input:
7
output:
U.U.U.U UDUDUDU LD.D.DR D.D.D.D D.D.D.D LD.D.DR .D.D.D.
result:
wrong answer Walls from cells (1, 5), (1, 6) overlap