QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#132268#5572. Gridlandiatselmegkh#Compile Error//C++201.8kb2023-07-29 11:44:292023-07-29 11:44:30

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:30]
  • 评测
  • [2023-07-29 11:44:29]
  • 提交

answer

    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <set>
    #include <map>
    #include <queue>
    #include <stack>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <iomanip>
    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

answer.code: In function ‘void solve()’:
answer.code:38:13: error: ‘assert’ was not declared in this scope
   38 |             assert(y >= 0);
      |             ^~~~~~
answer.code:12:1: note: ‘assert’ is defined in header ‘<cassert>’; did you forget to ‘#include <cassert>’?
   11 |     #include <iomanip>
  +++ |+#include <cassert>
   12 |     using namespace std;