QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#250043#7629. Make SYSU Great Again IIucup-team2307#TL 1435ms25820kbC++171.4kb2023-11-12 20:45:222023-11-12 20:45:22

Judging History

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

  • [2023-11-12 20:45:22]
  • 评测
  • 测评结果:TL
  • 用时:1435ms
  • 内存:25820kb
  • [2023-11-12 20:45:22]
  • 提交

answer

#include<bits/stdc++.h>

#define pb push_back
#define fi first
#define se second

//typedef long long ll;
//#define int ll

using namespace std;

int a[2020][2020];
int cnt[2020*2020*4];

const int M = 12;
const int FULL = (1<<M) - 1;
const int FULL2 = (1<<(2*M)) - 1;
vector<int> submasks[1<<M];

main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    for (int i=0; i<(1<<M); i++)
        for (int j=0; j<=i; j++)
            if ((i&j) == j)
                submasks[i].pb(j);
    int n;
    cin>>n;

    int mnk = 0;
    for (int i=1; i<=n; i++)
        for (int j=1; j<=n; j++)
    {
        while (cnt[mnk] == 5)
            mnk++;
        bool ok = false;
        int mask = FULL2 - (a[i][j-1] | a[i-1][j]);

        for (int k1 : submasks[mask>>M])
        {
            for (int k2 : submasks[mask&FULL])
            {
                int k = (k1<<M) + k2;
                if (k >= 4*n*n)
                    break;

                if (cnt[k] < 5)
                {
                    a[i][j] = k;
                    cnt[k]++;
                    ok = true;
                    break;
                }
            }
            if (ok)
                break;
        }
        if (!ok)
            cout<<"WA "<<i<<" "<<j<<"\n", exit(1);
    }
    cout<<"Yes\n";
    for (int i=1; i<=n; i++, cout<<"\n")
        for (int j=1; j<=n; j++)
            cout<<a[i][j]<<" ";
}

詳細信息

Test #1:

score: 100
Accepted
time: 7ms
memory: 5904kb

input:

4

output:

Yes
0 0 0 0 
0 1 2 1 
1 2 1 2 
2 1 2 4 

result:

ok 1

Test #2:

score: 0
Accepted
time: 7ms
memory: 5884kb

input:

1

output:

Yes
0 

result:

ok 1

Test #3:

score: 0
Accepted
time: 7ms
memory: 5892kb

input:

2

output:

Yes
0 0 
0 0 

result:

ok 1

Test #4:

score: 0
Accepted
time: 8ms
memory: 5880kb

input:

3

output:

Yes
0 0 0 
0 0 1 
1 2 4 

result:

ok 1

Test #5:

score: 0
Accepted
time: 7ms
memory: 5916kb

input:

5

output:

Yes
0 0 0 0 0 
1 2 1 2 1 
2 1 2 1 2 
4 8 4 8 4 
3 4 3 4 3 

result:

ok 1

Test #6:

score: 0
Accepted
time: 7ms
memory: 5932kb

input:

8

output:

Yes
0 0 0 0 0 1 2 1 
1 2 1 2 1 2 4 2 
4 8 4 8 4 8 3 4 
3 16 3 16 3 16 8 3 
8 5 16 5 16 5 18 12 
5 10 5 10 32 10 32 17 
10 17 10 17 6 17 6 32 
17 6 32 6 9 6 9 18 

result:

ok 1

Test #7:

score: 0
Accepted
time: 7ms
memory: 5960kb

input:

13

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 
1 2 4 3 4 8 4 8 4 8 4 8 5 
6 8 3 12 3 16 3 16 3 16 9 6 16 
9 6 16 32 12 32 12 32 12 32 6 9 6 
18 9 32 5 18 5 18 5 18 5 24 34 9 
12 18 13 34 13 34 13 34 13 34 64 13 48 
17 36 64 17 64 17 64 17 64 17 10 48 7 
10 65 10 36 10 36 10 36 11 36 65 14 48 
20 40 20 11 20 11 20 1...

result:

ok 1

Test #8:

score: 0
Accepted
time: 3ms
memory: 5984kb

input:

21

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 
3 4 3 4 8 6 8 6 8 6 8 6 8 6 9 16 12 16 12 16 12 
12 16 12 16 5 24 5 24 5 24 5 24 5 24 32 7 32 7 32 7 32 
17 10 17 10 32 7 40 7 40 64 10 33 10 33 10 48 9 48 9 48 9 
14 17 14 17 14 48 64 40 17 14 33 14 33 18 33 64 18 9 18 13 18 
48 64 49 64 49 66 13 18 36...

result:

ok 1

Test #9:

score: 0
Accepted
time: 2ms
memory: 5988kb

input:

34

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 
5 10 16 6 9 6 9 6 9 6 9 6 9 16 12 16 12 16 12 16 12 17 12 17 32 7 24 7 24 7 24 7 24 7 
10 17 10 17 32 17 32 24 32 25 32 25 34 13 18 13 18 13 18 13 18 36 18 36 10 48 64 40 64 40 64 40 64 40 
20 10 20 34 13 34 20 33 14 64 11 36 2...

result:

ok 1

Test #10:

score: 0
Accepted
time: 8ms
memory: 6132kb

input:

55

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 
7 24 32 10 17 10 17 10 17 10 17 12 17 12 32 11 20 11 20 11 20 11 20 11 20 32 18 32 18 32 18 33 18 33 18 33 12 33 22 33 22 40 22 40 22 40 22 40 64 12 48 12 48 13 48 
24 34 13 48 14...

result:

ok 1

Test #11:

score: 0
Accepted
time: 4ms
memory: 6244kb

input:

89

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 
11 20 32 13 32 14 32 14 33 14 33 14 33 14 33 24 36 19 36 19 36 19 36 19 36 19 ...

result:

ok 1

Test #12:

score: 0
Accepted
time: 9ms
memory: 6308kb

input:

100

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 
14 33 14 33 14 48 64 14 33 14 33 22 33 22 40 ...

result:

ok 1

Test #13:

score: 0
Accepted
time: 13ms
memory: 7016kb

input:

200

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #14:

score: 0
Accepted
time: 14ms
memory: 7768kb

input:

300

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #15:

score: 0
Accepted
time: 29ms
memory: 8648kb

input:

400

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #16:

score: 0
Accepted
time: 57ms
memory: 10864kb

input:

500

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #17:

score: 0
Accepted
time: 83ms
memory: 11288kb

input:

600

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #18:

score: 0
Accepted
time: 132ms
memory: 12504kb

input:

700

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #19:

score: 0
Accepted
time: 183ms
memory: 15852kb

input:

800

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #20:

score: 0
Accepted
time: 259ms
memory: 15176kb

input:

900

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #21:

score: 0
Accepted
time: 349ms
memory: 16852kb

input:

1000

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #22:

score: 0
Accepted
time: 595ms
memory: 21340kb

input:

1200

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #23:

score: 0
Accepted
time: 945ms
memory: 22632kb

input:

1400

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #24:

score: 0
Accepted
time: 1435ms
memory: 25820kb

input:

1600

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result:

ok 1

Test #25:

score: -100
Time Limit Exceeded

input:

1800

output:

Yes
0 0 0 0 0 1 2 1 2 1 2 1 2 1 2 4 3 4 3 4 3 4 3 4 3 8 5 8 5 8 5 8 5 8 5 10 16 6 9 6 9 6 9 6 9 6 9 16 7 16 7 16 7 16 7 24 7 24 32 10 17 10 17 10 17 10 17 12 17 12 18 12 18 12 18 12 18 13 18 13 32 11 20 11 20 11 20 11 20 11 20 32 13 32 13 32 13 34 21 34 21 34 21 34 21 34 21 40 19 36 19 36 19 36 19 3...

result: