QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#132269#5572. Gridlandiatselmegkh#WA 1ms3580kbC++201.8kb2023-07-29 11:44:552023-07-29 11:44:55

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-29 11:44:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3580kb
  • [2023-07-29 11:44:55]
  • 提交

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;
    }

Details

Tip: Click on the bar to expand more detailed information

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