QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#180999 | #7225. The Kirakira Cycle | ckiseki# | WA | 1653ms | 3724kb | C++17 | 717b | 2023-09-16 14:58:14 | 2023-09-16 14:58:14 |
Judging History
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, 250000 / n);
for (int it = 0; it < B; it++) {
int x = rng() % (n * n), y = x;
int c = 0;
do {
x = f(x);
y = f(f(y));
++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;
}
cout << mx << '\n';
// cout << "ans = " << ans << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
input:
2
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 7ms
memory: 3712kb
input:
10
output:
4
result:
ok 1 number(s): "4"
Test #3:
score: 0
Accepted
time: 13ms
memory: 3660kb
input:
43
output:
7
result:
ok 1 number(s): "7"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 3ms
memory: 3568kb
input:
3
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 5ms
memory: 3640kb
input:
4
output:
3
result:
ok 1 number(s): "3"
Test #7:
score: 0
Accepted
time: 4ms
memory: 3668kb
input:
5
output:
2
result:
ok 1 number(s): "2"
Test #8:
score: 0
Accepted
time: 4ms
memory: 3636kb
input:
6
output:
2
result:
ok 1 number(s): "2"
Test #9:
score: 0
Accepted
time: 4ms
memory: 3632kb
input:
7
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 5ms
memory: 3720kb
input:
8
output:
3
result:
ok 1 number(s): "3"
Test #11:
score: 0
Accepted
time: 6ms
memory: 3592kb
input:
9
output:
2
result:
ok 1 number(s): "2"
Test #12:
score: 0
Accepted
time: 11ms
memory: 3656kb
input:
11
output:
7
result:
ok 1 number(s): "7"
Test #13:
score: 0
Accepted
time: 8ms
memory: 3600kb
input:
13
output:
6
result:
ok 1 number(s): "6"
Test #14:
score: 0
Accepted
time: 6ms
memory: 3580kb
input:
17
output:
4
result:
ok 1 number(s): "4"
Test #15:
score: 0
Accepted
time: 7ms
memory: 3600kb
input:
19
output:
5
result:
ok 1 number(s): "5"
Test #16:
score: 0
Accepted
time: 13ms
memory: 3660kb
input:
23
output:
3
result:
ok 1 number(s): "3"
Test #17:
score: 0
Accepted
time: 10ms
memory: 3596kb
input:
29
output:
2
result:
ok 1 number(s): "2"
Test #18:
score: 0
Accepted
time: 14ms
memory: 3596kb
input:
31
output:
13
result:
ok 1 number(s): "13"
Test #19:
score: 0
Accepted
time: 15ms
memory: 3724kb
input:
37
output:
5
result:
ok 1 number(s): "5"
Test #20:
score: 0
Accepted
time: 23ms
memory: 3636kb
input:
41
output:
21
result:
ok 1 number(s): "21"
Test #21:
score: 0
Accepted
time: 19ms
memory: 3660kb
input:
60
output:
8
result:
ok 1 number(s): "8"
Test #22:
score: 0
Accepted
time: 31ms
memory: 3724kb
input:
100
output:
11
result:
ok 1 number(s): "11"
Test #23:
score: 0
Accepted
time: 50ms
memory: 3656kb
input:
105
output:
41
result:
ok 1 number(s): "41"
Test #24:
score: 0
Accepted
time: 42ms
memory: 3604kb
input:
128
output:
31
result:
ok 1 number(s): "31"
Test #25:
score: 0
Accepted
time: 53ms
memory: 3600kb
input:
130
output:
25
result:
ok 1 number(s): "25"
Test #26:
score: 0
Accepted
time: 93ms
memory: 3580kb
input:
256
output:
52
result:
ok 1 number(s): "52"
Test #27:
score: 0
Accepted
time: 79ms
memory: 3716kb
input:
290
output:
15
result:
ok 1 number(s): "15"
Test #28:
score: 0
Accepted
time: 162ms
memory: 3636kb
input:
455
output:
104
result:
ok 1 number(s): "104"
Test #29:
score: 0
Accepted
time: 89ms
memory: 3588kb
input:
512
output:
45
result:
ok 1 number(s): "45"
Test #30:
score: 0
Accepted
time: 181ms
memory: 3652kb
input:
777
output:
35
result:
ok 1 number(s): "35"
Test #31:
score: 0
Accepted
time: 201ms
memory: 3588kb
input:
707
output:
175
result:
ok 1 number(s): "175"
Test #32:
score: 0
Accepted
time: 107ms
memory: 3600kb
input:
449
output:
13
result:
ok 1 number(s): "13"
Test #33:
score: 0
Accepted
time: 246ms
memory: 3588kb
input:
573
output:
168
result:
ok 1 number(s): "168"
Test #34:
score: 0
Accepted
time: 131ms
memory: 3632kb
input:
858
output:
49
result:
ok 1 number(s): "49"
Test #35:
score: 0
Accepted
time: 73ms
memory: 3568kb
input:
230
output:
58
result:
ok 1 number(s): "58"
Test #36:
score: 0
Accepted
time: 174ms
memory: 3668kb
input:
972
output:
117
result:
ok 1 number(s): "117"
Test #37:
score: 0
Accepted
time: 152ms
memory: 3656kb
input:
844
output:
47
result:
ok 1 number(s): "47"
Test #38:
score: 0
Accepted
time: 187ms
memory: 3656kb
input:
378
output:
37
result:
ok 1 number(s): "37"
Test #39:
score: 0
Accepted
time: 86ms
memory: 3720kb
input:
423
output:
49
result:
ok 1 number(s): "49"
Test #40:
score: 0
Accepted
time: 39ms
memory: 3600kb
input:
209
output:
20
result:
ok 1 number(s): "20"
Test #41:
score: 0
Accepted
time: 600ms
memory: 3652kb
input:
5645
output:
338
result:
ok 1 number(s): "338"
Test #42:
score: 0
Accepted
time: 368ms
memory: 3636kb
input:
2034
output:
249
result:
ok 1 number(s): "249"
Test #43:
score: 0
Accepted
time: 867ms
memory: 3636kb
input:
6163
output:
206
result:
ok 1 number(s): "206"
Test #44:
score: 0
Accepted
time: 735ms
memory: 3636kb
input:
6422
output:
346
result:
ok 1 number(s): "346"
Test #45:
score: 0
Accepted
time: 195ms
memory: 3716kb
input:
1550
output:
40
result:
ok 1 number(s): "40"
Test #46:
score: 0
Accepted
time: 1084ms
memory: 3628kb
input:
6940
output:
674
result:
ok 1 number(s): "674"
Test #47:
score: 0
Accepted
time: 219ms
memory: 3648kb
input:
2068
output:
157
result:
ok 1 number(s): "157"
Test #48:
score: 0
Accepted
time: 781ms
memory: 3632kb
input:
6197
output:
594
result:
ok 1 number(s): "594"
Test #49:
score: 0
Accepted
time: 1180ms
memory: 3600kb
input:
6456
output:
913
result:
ok 1 number(s): "913"
Test #50:
score: 0
Accepted
time: 904ms
memory: 3636kb
input:
8776
output:
423
result:
ok 1 number(s): "423"
Test #51:
score: 0
Accepted
time: 525ms
memory: 3604kb
input:
3904
output:
281
result:
ok 1 number(s): "281"
Test #52:
score: 0
Accepted
time: 571ms
memory: 3572kb
input:
4163
output:
230
result:
ok 1 number(s): "230"
Test #53:
score: 0
Accepted
time: 724ms
memory: 3656kb
input:
4422
output:
631
result:
ok 1 number(s): "631"
Test #54:
score: 0
Accepted
time: 448ms
memory: 3652kb
input:
4681
output:
95
result:
ok 1 number(s): "95"
Test #55:
score: 0
Accepted
time: 1208ms
memory: 3692kb
input:
8810
output:
835
result:
ok 1 number(s): "835"
Test #56:
score: 0
Accepted
time: 629ms
memory: 3636kb
input:
3938
output:
350
result:
ok 1 number(s): "350"
Test #57:
score: 0
Accepted
time: 1396ms
memory: 3652kb
input:
9328
output:
373
result:
ok 1 number(s): "373"
Test #58:
score: 0
Accepted
time: 1304ms
memory: 3600kb
input:
4456
output:
932
result:
ok 1 number(s): "932"
Test #59:
score: 0
Accepted
time: 912ms
memory: 3588kb
input:
4715
output:
476
result:
ok 1 number(s): "476"
Test #60:
score: 0
Accepted
time: 797ms
memory: 3596kb
input:
7633
output:
591
result:
ok 1 number(s): "591"
Test #61:
score: 0
Accepted
time: 904ms
memory: 3636kb
input:
2762
output:
263
result:
ok 1 number(s): "263"
Test #62:
score: 0
Accepted
time: 779ms
memory: 3636kb
input:
8152
output:
465
result:
ok 1 number(s): "465"
Test #63:
score: 0
Accepted
time: 589ms
memory: 3664kb
input:
3280
output:
157
result:
ok 1 number(s): "157"
Test #64:
score: 0
Accepted
time: 366ms
memory: 3712kb
input:
3539
output:
79
result:
ok 1 number(s): "79"
Test #65:
score: 0
Accepted
time: 1653ms
memory: 3636kb
input:
7668
output:
905
result:
ok 1 number(s): "905"
Test #66:
score: 0
Accepted
time: 663ms
memory: 3640kb
input:
7927
output:
357
result:
ok 1 number(s): "357"
Test #67:
score: 0
Accepted
time: 1162ms
memory: 3636kb
input:
8186
output:
543
result:
ok 1 number(s): "543"
Test #68:
score: 0
Accepted
time: 629ms
memory: 3632kb
input:
3314
output:
306
result:
ok 1 number(s): "306"
Test #69:
score: 0
Accepted
time: 489ms
memory: 3716kb
input:
3573
output:
69
result:
ok 1 number(s): "69"
Test #70:
score: 0
Accepted
time: 740ms
memory: 3636kb
input:
6873
output:
667
result:
ok 1 number(s): "667"
Test #71:
score: 0
Accepted
time: 264ms
memory: 3592kb
input:
2001
output:
134
result:
ok 1 number(s): "134"
Test #72:
score: 0
Accepted
time: 628ms
memory: 3632kb
input:
7391
output:
477
result:
ok 1 number(s): "477"
Test #73:
score: 0
Accepted
time: 335ms
memory: 3652kb
input:
2519
output:
267
result:
ok 1 number(s): "267"
Test #74:
score: 0
Accepted
time: 269ms
memory: 3636kb
input:
2778
output:
162
result:
ok 1 number(s): "162"
Test #75:
score: 0
Accepted
time: 558ms
memory: 3668kb
input:
3037
output:
282
result:
ok 1 number(s): "282"
Test #76:
score: 0
Accepted
time: 842ms
memory: 3724kb
input:
3296
output:
458
result:
ok 1 number(s): "458"
Test #77:
score: 0
Accepted
time: 906ms
memory: 3648kb
input:
7426
output:
214
result:
ok 1 number(s): "214"
Test #78:
score: 0
Accepted
time: 556ms
memory: 3664kb
input:
2554
output:
102
result:
ok 1 number(s): "102"
Test #79:
score: 0
Accepted
time: 694ms
memory: 3636kb
input:
7944
output:
283
result:
ok 1 number(s): "283"
Test #80:
score: -100
Wrong Answer
time: 785ms
memory: 3688kb
input:
6113
output:
45
result:
wrong answer 1st numbers differ - expected: '121', found: '45'