QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#253797#7629. Make SYSU Great Again IItuanlinh123RE 0ms0kbC++201.3kb2023-11-17 15:47:502023-11-17 15:47:50

Judging History

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

  • [2023-11-17 15:47:50]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-11-17 15:47:50]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;

ll gray(ll i)
{
    return i^(i>>1);
}

ll a[2005][2005];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    ll n; cin >> n;
    for (ll i=1; i<=n; i++)
        for (ll j=1; j<=n; j++)
            a[i][j]=-1;
    ll b=__lg(n*2), all=(1<<(b*2))-1;
    for (ll k=2; k<=n*2; k+=2)
    {
        ll val=gray(k/2-1);
        for (ll i=1; i<=n; i++)
        {
            ll j=k-i;
            if (j<=0 || j>n)
                continue;
            a[i][j]=val;
        }
    }
    for (ll k=-n+1; k<=n-1; k+=2)
    {
        ll val=gray((k+n-1)/2)<<b;
        for (ll i=1; i<=n; i++)
        {
            ll j=i-k;
            if (j<=0 || j>n)
                continue;
            a[i][j]|=val;
        }
    }
    cout << "Yes\n";
    for (ll i=1; i<=n; i++)
        for (ll j=1; j<=n; j++)
        {
            if (a[i][j]==-1)
                a[i][j]=(a[i-1][j]|a[i][j-1]|a[i+1][j]|a[i][j+1])^all;
            cout << a[i][j] << " \n"[j==n];
        }
}

详细

Test #1:

score: 0
Dangerous Syscalls

input:

4

output:


result: