QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#132269 | #5572. Gridlandia | tselmegkh# | WA | 1ms | 3580kb | C++20 | 1.8kb | 2023-07-29 11:44:55 | 2023-07-29 11:44:55 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <cassert>
using namespace std;
const int N = 1e3 + 5, inf = 1e9;
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define sz(x) (int)x.size()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
char ans[N][N];
void solve(){
int n;
cin >> n;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
ans[i][j] = '.';
}
}
for(int l = 1; l <= (n + 1) / 2; l++){
int x = (n - l + 1);
int y = n - (l - 1) * 2;
assert(y >= 0);
for(int j = l; j <= n - l + 1; j += 2){
ans[l][j] = 'U';
}
for(int i = (y % 2 == 1 ? l + 1 : l); i <= n - l + 1; i += 2){
ans[i][n - l + 1] = 'R';
}
for(int j = x; j >= l; j -= 2){
ans[n - l + 1][j] = 'D';
}
for(int i = (y % 2 == 1 ? x - 1 : x); i >= l; i -= 2){
ans[i][l] = 'L';
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
cout << ans[i][j];
}
cout << '\n';
}
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3464kb
input:
1
output:
D
result:
ok answer = 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
2
output:
UR LD
result:
ok answer = 4
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3468kb
input:
3
output:
U.U LDR D.D
result:
wrong answer jury has the better answer: jans = 8, pans = 7