QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130014#4248. Number TheorySolitaryDream#AC ✓367ms4348kbC++14593b2023-07-23 13:46:012023-07-23 13:46:04

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-23 13:46:04]
  • 评测
  • 测评结果:AC
  • 用时:367ms
  • 内存:4348kb
  • [2023-07-23 13:46:01]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int p;
int f[N];
bitset<N> unvis, g, h, tmp;
int main() {
    scanf("%d", &p);
    for (int i = 0; i < p; ++i) {
        g.set(1ll * i * i % p);
        unvis.set(i);
    }
    for (int o = 0; o < p; ++o) {
        int cur = 1ll * o * o % p;
        h = (g << cur) | (g >> (p - cur));
        tmp = h & unvis;
        unvis &= (~tmp);
        for (int i = tmp._Find_first(); i != N; i = tmp._Find_next(i)) {
            f[i] = o;
        }
    }
    printf("%d\n", *max_element(f, f + p));
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3672kb

input:

2

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

3

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3956kb

input:

5

output:

2

result:

ok 1 number(s): "2"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3956kb

input:

7

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 367ms
memory: 4136kb

input:

99991

output:

20

result:

ok 1 number(s): "20"

Test #6:

score: 0
Accepted
time: 65ms
memory: 3792kb

input:

17041

output:

13

result:

ok 1 number(s): "13"

Test #7:

score: 0
Accepted
time: 89ms
memory: 4020kb

input:

25343

output:

12

result:

ok 1 number(s): "12"

Test #8:

score: 0
Accepted
time: 137ms
memory: 3888kb

input:

37309

output:

15

result:

ok 1 number(s): "15"

Test #9:

score: 0
Accepted
time: 206ms
memory: 4180kb

input:

58027

output:

15

result:

ok 1 number(s): "15"

Test #10:

score: 0
Accepted
time: 169ms
memory: 4000kb

input:

47843

output:

19

result:

ok 1 number(s): "19"

Test #11:

score: 0
Accepted
time: 125ms
memory: 3924kb

input:

33857

output:

14

result:

ok 1 number(s): "14"

Test #12:

score: 0
Accepted
time: 205ms
memory: 4188kb

input:

58921

output:

18

result:

ok 1 number(s): "18"

Test #13:

score: 0
Accepted
time: 313ms
memory: 4180kb

input:

90821

output:

14

result:

ok 1 number(s): "14"

Test #14:

score: 0
Accepted
time: 188ms
memory: 3928kb

input:

51749

output:

14

result:

ok 1 number(s): "14"

Test #15:

score: 0
Accepted
time: 66ms
memory: 3804kb

input:

16223

output:

14

result:

ok 1 number(s): "14"

Test #16:

score: 0
Accepted
time: 273ms
memory: 4256kb

input:

75503

output:

15

result:

ok 1 number(s): "15"

Test #17:

score: 0
Accepted
time: 116ms
memory: 3860kb

input:

29287

output:

15

result:

ok 1 number(s): "15"

Test #18:

score: 0
Accepted
time: 278ms
memory: 4028kb

input:

75653

output:

14

result:

ok 1 number(s): "14"

Test #19:

score: 0
Accepted
time: 217ms
memory: 3988kb

input:

61667

output:

17

result:

ok 1 number(s): "17"

Test #20:

score: 0
Accepted
time: 202ms
memory: 4052kb

input:

57773

output:

20

result:

ok 1 number(s): "20"

Test #21:

score: 0
Accepted
time: 280ms
memory: 4116kb

input:

82009

output:

17

result:

ok 1 number(s): "17"

Test #22:

score: 0
Accepted
time: 85ms
memory: 3812kb

input:

24251

output:

14

result:

ok 1 number(s): "14"

Test #23:

score: 0
Accepted
time: 339ms
memory: 4348kb

input:

99733

output:

17

result:

ok 1 number(s): "17"

Test #24:

score: 0
Accepted
time: 95ms
memory: 3820kb

input:

25849

output:

15

result:

ok 1 number(s): "15"

Test #25:

score: 0
Accepted
time: 265ms
memory: 4244kb

input:

72949

output:

18

result:

ok 1 number(s): "18"

Test #26:

score: 0
Accepted
time: 324ms
memory: 4072kb

input:

93523

output:

16

result:

ok 1 number(s): "16"

Test #27:

score: 0
Accepted
time: 274ms
memory: 3976kb

input:

75577

output:

16

result:

ok 1 number(s): "16"

Test #28:

score: 0
Accepted
time: 157ms
memory: 3956kb

input:

43201

output:

14

result:

ok 1 number(s): "14"

Test #29:

score: 0
Accepted
time: 354ms
memory: 4312kb

input:

99713

output:

20

result:

ok 1 number(s): "20"

Test #30:

score: 0
Accepted
time: 301ms
memory: 4144kb

input:

89563

output:

17

result:

ok 1 number(s): "17"

Test #31:

score: 0
Accepted
time: 60ms
memory: 3976kb

input:

15767

output:

14

result:

ok 1 number(s): "14"

Test #32:

score: 0
Accepted
time: 188ms
memory: 3880kb

input:

52379

output:

16

result:

ok 1 number(s): "16"

Test #33:

score: 0
Accepted
time: 106ms
memory: 3840kb

input:

28663

output:

21

result:

ok 1 number(s): "21"

Test #34:

score: 0
Accepted
time: 20ms
memory: 3976kb

input:

5087

output:

11

result:

ok 1 number(s): "11"

Test #35:

score: 0
Accepted
time: 89ms
memory: 3820kb

input:

24097

output:

14

result:

ok 1 number(s): "14"

Test #36:

score: 0
Accepted
time: 287ms
memory: 4296kb

input:

83047

output:

15

result:

ok 1 number(s): "15"

Test #37:

score: 0
Accepted
time: 254ms
memory: 4008kb

input:

70913

output:

15

result:

ok 1 number(s): "15"

Test #38:

score: 0
Accepted
time: 27ms
memory: 3776kb

input:

8069

output:

17

result:

ok 1 number(s): "17"

Test #39:

score: 0
Accepted
time: 266ms
memory: 4012kb

input:

72937

output:

18

result:

ok 1 number(s): "18"

Test #40:

score: 0
Accepted
time: 36ms
memory: 4004kb

input:

9391

output:

11

result:

ok 1 number(s): "11"

Test #41:

score: 0
Accepted
time: 227ms
memory: 4000kb

input:

63977

output:

15

result:

ok 1 number(s): "15"

Test #42:

score: 0
Accepted
time: 27ms
memory: 3772kb

input:

6779

output:

13

result:

ok 1 number(s): "13"

Test #43:

score: 0
Accepted
time: 10ms
memory: 3968kb

input:

3209

output:

11

result:

ok 1 number(s): "11"

Test #44:

score: 0
Accepted
time: 268ms
memory: 4268kb

input:

77081

output:

21

result:

ok 1 number(s): "21"

Test #45:

score: 0
Accepted
time: 353ms
memory: 4112kb

input:

98533

output:

18

result:

ok 1 number(s): "18"

Test #46:

score: 0
Accepted
time: 110ms
memory: 3936kb

input:

28859

output:

13

result:

ok 1 number(s): "13"

Test #47:

score: 0
Accepted
time: 48ms
memory: 3788kb

input:

12907

output:

13

result:

ok 1 number(s): "13"

Test #48:

score: 0
Accepted
time: 82ms
memory: 3876kb

input:

22349

output:

13

result:

ok 1 number(s): "13"

Test #49:

score: 0
Accepted
time: 41ms
memory: 3764kb

input:

11057

output:

13

result:

ok 1 number(s): "13"

Test #50:

score: 0
Accepted
time: 55ms
memory: 3980kb

input:

15809

output:

15

result:

ok 1 number(s): "15"

Test #51:

score: 0
Accepted
time: 56ms
memory: 3864kb

input:

14437

output:

14

result:

ok 1 number(s): "14"

Test #52:

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

input:

163

output:

5

result:

ok 1 number(s): "5"

Test #53:

score: 0
Accepted
time: 298ms
memory: 4304kb

input:

87313

output:

14

result:

ok 1 number(s): "14"

Test #54:

score: 0
Accepted
time: 1ms
memory: 3880kb

input:

761

output:

10

result:

ok 1 number(s): "10"

Test #55:

score: 0
Accepted
time: 299ms
memory: 4076kb

input:

86239

output:

16

result:

ok 1 number(s): "16"

Test #56:

score: 0
Accepted
time: 321ms
memory: 4088kb

input:

90163

output:

17

result:

ok 1 number(s): "17"

Test #57:

score: 0
Accepted
time: 114ms
memory: 4084kb

input:

30859

output:

14

result:

ok 1 number(s): "14"

Test #58:

score: 0
Accepted
time: 174ms
memory: 3932kb

input:

47807

output:

15

result:

ok 1 number(s): "15"

Test #59:

score: 0
Accepted
time: 25ms
memory: 3772kb

input:

7547

output:

11

result:

ok 1 number(s): "11"

Test #60:

score: 0
Accepted
time: 49ms
memory: 3716kb

input:

13327

output:

12

result:

ok 1 number(s): "12"

Test #61:

score: 0
Accepted
time: 124ms
memory: 3884kb

input:

33577

output:

15

result:

ok 1 number(s): "15"

Test #62:

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

input:

127

output:

6

result:

ok 1 number(s): "6"

Test #63:

score: 0
Accepted
time: 153ms
memory: 4124kb

input:

38711

output:

14

result:

ok 1 number(s): "14"

Test #64:

score: 0
Accepted
time: 36ms
memory: 3760kb

input:

8377

output:

11

result:

ok 1 number(s): "11"

Test #65:

score: 0
Accepted
time: 134ms
memory: 3932kb

input:

36607

output:

15

result:

ok 1 number(s): "15"

Test #66:

score: 0
Accepted
time: 285ms
memory: 4052kb

input:

83299

output:

17

result:

ok 1 number(s): "17"

Test #67:

score: 0
Accepted
time: 54ms
memory: 3804kb

input:

14303

output:

16

result:

ok 1 number(s): "16"

Test #68:

score: 0
Accepted
time: 117ms
memory: 3828kb

input:

32003

output:

14

result:

ok 1 number(s): "14"