QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#181082#7225. The Kirakira Cycleckiseki#WA 1391ms3728kbC++17907b2023-09-16 15:39:522023-09-16 15:39:53

Judging History

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

  • [2023-09-16 15:39:53]
  • 评测
  • 测评结果:WA
  • 用时:1391ms
  • 内存:3728kb
  • [2023-09-16 15:39:52]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;

  auto f = [n](int x) {
    int res = 0;
    for (int i = 2; i <= n; i++)
      res += x % i;
    return res;
  };

  mt19937 rng(12390);

  int mx = 0;

  int B = max(1, 100000 / n);
  bool flag = false;
  const auto gao = [&](int x) {
    int y = x;

    int c = 0;
    do {
      x = f(x);
      y = f(f(y));
      if (flag)
        if (x < B || y < B) return;
      ++c;
    } while (x != y);

    int ans = 0;
    do {
      y = f(y);
      ++ans;
    } while (y != x);
    mx = max(mx, ans);
    // cerr << "c = " << c << endl;
    // cerr << "ans = " << ans << endl;
  };

  for (int it = 0; it < B; it++) {
    gao(it + 1);
  }

  flag = true;

  for (int it = 0; it < B; it++) {
    gao(rng() % (n * n));
  }

  cout << mx << '\n';
  // cout << "ans = " << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

10

output:

4

result:

ok 1 number(s): "4"

Test #3:

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

input:

43

output:

7

result:

ok 1 number(s): "7"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

3

output:

1

result:

ok 1 number(s): "1"

Test #6:

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

input:

4

output:

3

result:

ok 1 number(s): "3"

Test #7:

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

input:

5

output:

2

result:

ok 1 number(s): "2"

Test #8:

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

input:

6

output:

2

result:

ok 1 number(s): "2"

Test #9:

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

input:

7

output:

1

result:

ok 1 number(s): "1"

Test #10:

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

input:

8

output:

3

result:

ok 1 number(s): "3"

Test #11:

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

input:

9

output:

2

result:

ok 1 number(s): "2"

Test #12:

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

input:

11

output:

7

result:

ok 1 number(s): "7"

Test #13:

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

input:

13

output:

6

result:

ok 1 number(s): "6"

Test #14:

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

input:

17

output:

4

result:

ok 1 number(s): "4"

Test #15:

score: 0
Accepted
time: 5ms
memory: 3672kb

input:

19

output:

5

result:

ok 1 number(s): "5"

Test #16:

score: 0
Accepted
time: 6ms
memory: 3604kb

input:

23

output:

3

result:

ok 1 number(s): "3"

Test #17:

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

input:

29

output:

2

result:

ok 1 number(s): "2"

Test #18:

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

input:

31

output:

13

result:

ok 1 number(s): "13"

Test #19:

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

input:

37

output:

5

result:

ok 1 number(s): "5"

Test #20:

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

input:

41

output:

21

result:

ok 1 number(s): "21"

Test #21:

score: 0
Accepted
time: 6ms
memory: 3640kb

input:

60

output:

8

result:

ok 1 number(s): "8"

Test #22:

score: 0
Accepted
time: 22ms
memory: 3640kb

input:

100

output:

11

result:

ok 1 number(s): "11"

Test #23:

score: 0
Accepted
time: 40ms
memory: 3672kb

input:

105

output:

41

result:

ok 1 number(s): "41"

Test #24:

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

input:

128

output:

31

result:

ok 1 number(s): "31"

Test #25:

score: 0
Accepted
time: 43ms
memory: 3660kb

input:

130

output:

25

result:

ok 1 number(s): "25"

Test #26:

score: 0
Accepted
time: 70ms
memory: 3596kb

input:

256

output:

52

result:

ok 1 number(s): "52"

Test #27:

score: 0
Accepted
time: 64ms
memory: 3604kb

input:

290

output:

15

result:

ok 1 number(s): "15"

Test #28:

score: 0
Accepted
time: 130ms
memory: 3636kb

input:

455

output:

104

result:

ok 1 number(s): "104"

Test #29:

score: 0
Accepted
time: 71ms
memory: 3600kb

input:

512

output:

45

result:

ok 1 number(s): "45"

Test #30:

score: 0
Accepted
time: 145ms
memory: 3600kb

input:

777

output:

35

result:

ok 1 number(s): "35"

Test #31:

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

input:

707

output:

175

result:

ok 1 number(s): "175"

Test #32:

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

input:

449

output:

13

result:

ok 1 number(s): "13"

Test #33:

score: 0
Accepted
time: 196ms
memory: 3640kb

input:

573

output:

168

result:

ok 1 number(s): "168"

Test #34:

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

input:

858

output:

49

result:

ok 1 number(s): "49"

Test #35:

score: 0
Accepted
time: 59ms
memory: 3652kb

input:

230

output:

58

result:

ok 1 number(s): "58"

Test #36:

score: 0
Accepted
time: 138ms
memory: 3728kb

input:

972

output:

117

result:

ok 1 number(s): "117"

Test #37:

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

input:

844

output:

47

result:

ok 1 number(s): "47"

Test #38:

score: 0
Accepted
time: 152ms
memory: 3656kb

input:

378

output:

37

result:

ok 1 number(s): "37"

Test #39:

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

input:

423

output:

49

result:

ok 1 number(s): "49"

Test #40:

score: 0
Accepted
time: 32ms
memory: 3724kb

input:

209

output:

20

result:

ok 1 number(s): "20"

Test #41:

score: 0
Accepted
time: 485ms
memory: 3640kb

input:

5645

output:

338

result:

ok 1 number(s): "338"

Test #42:

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

input:

2034

output:

249

result:

ok 1 number(s): "249"

Test #43:

score: 0
Accepted
time: 692ms
memory: 3636kb

input:

6163

output:

206

result:

ok 1 number(s): "206"

Test #44:

score: 0
Accepted
time: 557ms
memory: 3660kb

input:

6422

output:

346

result:

ok 1 number(s): "346"

Test #45:

score: 0
Accepted
time: 159ms
memory: 3640kb

input:

1550

output:

40

result:

ok 1 number(s): "40"

Test #46:

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

input:

6940

output:

674

result:

ok 1 number(s): "674"

Test #47:

score: 0
Accepted
time: 190ms
memory: 3636kb

input:

2068

output:

157

result:

ok 1 number(s): "157"

Test #48:

score: 0
Accepted
time: 626ms
memory: 3596kb

input:

6197

output:

594

result:

ok 1 number(s): "594"

Test #49:

score: 0
Accepted
time: 964ms
memory: 3604kb

input:

6456

output:

913

result:

ok 1 number(s): "913"

Test #50:

score: 0
Accepted
time: 766ms
memory: 3660kb

input:

8776

output:

423

result:

ok 1 number(s): "423"

Test #51:

score: 0
Accepted
time: 438ms
memory: 3636kb

input:

3904

output:

281

result:

ok 1 number(s): "281"

Test #52:

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

input:

4163

output:

230

result:

ok 1 number(s): "230"

Test #53:

score: 0
Accepted
time: 560ms
memory: 3724kb

input:

4422

output:

631

result:

ok 1 number(s): "631"

Test #54:

score: 0
Accepted
time: 343ms
memory: 3656kb

input:

4681

output:

95

result:

ok 1 number(s): "95"

Test #55:

score: 0
Accepted
time: 863ms
memory: 3608kb

input:

8810

output:

835

result:

ok 1 number(s): "835"

Test #56:

score: 0
Accepted
time: 467ms
memory: 3596kb

input:

3938

output:

350

result:

ok 1 number(s): "350"

Test #57:

score: 0
Accepted
time: 1104ms
memory: 3640kb

input:

9328

output:

373

result:

ok 1 number(s): "373"

Test #58:

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

input:

4456

output:

932

result:

ok 1 number(s): "932"

Test #59:

score: 0
Accepted
time: 764ms
memory: 3728kb

input:

4715

output:

476

result:

ok 1 number(s): "476"

Test #60:

score: 0
Accepted
time: 582ms
memory: 3724kb

input:

7633

output:

591

result:

ok 1 number(s): "591"

Test #61:

score: 0
Accepted
time: 694ms
memory: 3640kb

input:

2762

output:

263

result:

ok 1 number(s): "263"

Test #62:

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

input:

8152

output:

465

result:

ok 1 number(s): "465"

Test #63:

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

input:

3280

output:

157

result:

ok 1 number(s): "157"

Test #64:

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

input:

3539

output:

79

result:

ok 1 number(s): "79"

Test #65:

score: 0
Accepted
time: 1391ms
memory: 3636kb

input:

7668

output:

905

result:

ok 1 number(s): "905"

Test #66:

score: 0
Accepted
time: 484ms
memory: 3656kb

input:

7927

output:

357

result:

ok 1 number(s): "357"

Test #67:

score: 0
Accepted
time: 889ms
memory: 3724kb

input:

8186

output:

543

result:

ok 1 number(s): "543"

Test #68:

score: 0
Accepted
time: 482ms
memory: 3600kb

input:

3314

output:

306

result:

ok 1 number(s): "306"

Test #69:

score: -100
Wrong Answer
time: 384ms
memory: 3576kb

input:

3573

output:

33

result:

wrong answer 1st numbers differ - expected: '69', found: '33'