QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253794#7629. Make SYSU Great Again IItuanlinh123WA 1ms3564kbC++201.2kb2023-11-17 15:45:232023-11-17 15:45:23

Judging History

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

  • [2023-11-17 15:45:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3564kb
  • [2023-11-17 15:45:23]
  • 提交

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3564kb

input:

4

output:

0 62 1 60
62 1 60 3
1 60 3 60
60 3 60 2

result:

wrong answer Unexpected Ans