QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#450542#7979. 棋盘HuTao0 1ms4360kbC++142.3kb2024-06-22 15:22:182024-06-22 15:22:18

Judging History

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

  • [2024-06-22 15:22:18]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4360kb
  • [2024-06-22 15:22:18]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 105, T = 17, K = 6;
const LL R = 1e17;

char buf[N];
struct BigInt{
    LL a[N];
    inline BigInt()
    {
        memset(a, 0, sizeof a);
    }
    inline void Read()
    {
        scanf("%s", buf);
        int n = strlen(buf);
        LL s = 1;
        for(int i = n - 1, j = 0, k = 0; i >= 0; i -- )
        {
            a[k] += s * (buf[i] ^ 48);
            j ++ , s *= 10;
            if(j == T) j = 0, s = 1, k ++ ;
        }
    }
    inline void Write()
    {
        int j = 0;
        for(int i = 0; i < K; i ++ )
        {
            LL t = a[i];
            for(int k = 0; k < T; k ++ ) buf[j ++ ] = (t % 10) ^ 48, t /= 10;
        }
        while(j > 1 && buf[j - 1] == '0') j -- ;
        reverse(buf, buf + j), buf[j] = 0;
        puts(buf);
    }
    inline bool Comp(const BigInt &x)
    {
        for(int i = K - 1; i >= 0; i -- )
            if(a[i] != x.a[i])
                return a[i] < x.a[i];
        return 1;
    }
    inline void Add(const BigInt &x, const BigInt &y)
    {
        LL t = 0;
        for(int i = 0; i < K; i ++ )
        {
            t += x.a[i] + y.a[i];
            a[i] = t % R, t /= R;
        }
    }
    inline void Del(const BigInt &x)
    {
        LL t = 0;
        for(int i = 0; i < K; i ++ )
        {
            t += a[i] - x.a[i];
            a[i] = t < 0 ? R + t : t;
            t = t < 0 ? -1 : 0;
        }
    }
};

int n, q;
char res[966];
BigInt f[488], g;

int main()
{
    // freopen("data", "w", stdout);
    n = 960;
    f[1].a[0] = f[2].a[0] = 1;
    for(int i = 3; i <= 480; i ++ ) f[i].Add(f[i - 2], f[i - 1]);
    printf("%d\n", n);
    for(int i = 1; i <= 240; i ++ )
    {
        printf("%d %d\n", i, i);
        printf("%d %d\n", i + 1, i);
        printf("%d %d\n", i, i + 1);
        printf("%d %d\n", i, i + 2);
    }
    scanf("%d", &q);
    while(q -- )
    {
        g.Read();
        for(int i = 1; i <= 960; i ++ ) res[i] = '0';
        for(int i = 480; i >= 1; i -- )
            if(f[i].Comp(g))
            {
                res[i * 2] = '1';
                g.Del(f[i]);
            }
        puts(res + 1);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

3 999 1000 340
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

input:

12 10000 1000 340
358908473750
36343501002
904324605639
453955046266
725478753662
218319365131
882878650993
648345848966
474401697383
722377018680
718743783955
748051292505
167886140898
411111004914
327825244967
990026144963
623309580364
970889332700
319445927842
527624602835
453135227321
1153226125...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #3:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 4292kb

input:

100 10000 1000 340
87490023455826213450979333037504606824522062808297739018786336978222089712660133428564103979384831
874900289913204769749000879539227331559680630241808944569515663934025397982898503777823815274323967
8749002899116133353924895735921513229471979456689635148877567298640178774668643967...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #4:

score: 0
Wrong Answer

Test #7:

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

input:

100 10000 990 310
4083451712318559926139496762164571032902328806667934236880329773320213539959944736095945843081512968
7811890641057562314768022152641517082686481268288006737090208624016586608183953908313798353213188661
97358161226180890688421784730819518002666166790210320310558753031161862165361257...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #5:

score: 0
Wrong Answer

Test #9:

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

input:

100 10000 1050 260
8749002899132047697490008908470485461412677723566863434996575047286849703722697797645542008396185599
8749002899132047697490008908470485461412677699052921091826559946707718798046219210886366418022957055
7655377536740541735303757766642121742076255665128332760334129720709510994307378...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #6:

score: 0
Wrong Answer

Test #11:

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

input:

100 10000 1050 240
8749002899132047697490008908470485461412677723572849734285100881333676956761384191490477496469520383
874886939179415873527191365288672777702448917037688119492655525651250910013304087281579324577152991
87490028991320476974900089084704854614126777235728490149522637601883528949454159...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #7:

score: 0
Wrong Answer

Test #13:

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

input:

100 1 980 260
8749002899132047697490008908470485461309833682610292204604841418296589481615503153703163411103219711

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]

Subtask #8:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 0ms
memory: 4228kb

input:

100 10000 960 240
8749002899132047697015724510954438324957730968977252383122989921226002617013223698533483281626692607
8749002899132047697490008908470485461412677720507858663971304708923117942496885325656574463725010943
87148271065573131361716885470369961093519598137825155235803895087505468828694702...

output:

960
1 1
2 1
1 2
1 3
2 2
3 2
2 3
2 4
3 3
4 3
3 4
3 5
4 4
5 4
4 5
4 6
5 5
6 5
5 6
5 7
6 6
7 6
6 7
6 8
7 7
8 7
7 8
7 9
8 8
9 8
8 9
8 10
9 9
10 9
9 10
9 11
10 10
11 10
10 11
10 12
11 11
12 11
11 12
11 13
12 12
13 12
12 13
12 14
13 13
14 13
13 14
13 15
14 14
15 14
14 15
14 16
15 15
16 15
15 16
15 17
16 1...

result:

wrong answer Wrong[2]