QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#406743#5090. 妙妙题valeriu#4.81965 172ms37192kbC++201.5kb2024-05-07 17:19:282024-05-07 17:19:29

Judging History

This is the latest submission verdict.

  • [2024-05-07 17:19:29]
  • Judged
  • Verdict: 4.81965
  • Time: 172ms
  • Memory: 37192kb
  • [2024-05-07 17:19:28]
  • Submitted

answer

#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;

using ll = long long;
using ld = long double;

//#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<int,int>;
using tii = tuple<int,int,int>;

using ull = unsigned long long;

mt19937 rng(100);

int nbits(unsigned long long a) {
   if(a == 0) return 0;
   return 1 + nbits(a & (a - 1));
}

unordered_set<int> appeared;


int N;

bool count(ull A, bool& rez) {
   int cnt[2] = {0, 0};
   for(int i = 0; i < 2; i++) {
      if(appeared.count(A)) { rez = (A & 1); return 1; }
      for(int i = 1; i < N; i++) {
         if(appeared.count(A ^ (1 << i))) { rez = (A & 1); return 1; }
      }
      A ^= 1;
   }
   
   
   return 0;
}

void add(ull A) {
   for(int i = 0; i < N; i++) {
      appeared.emplace(A);
      A = (A >> 1) | ((A & 1) << (N - 1));
   }
   return;
}

void init (int N_, bool Type, int p) {
   N = N_;
   rng = mt19937(chrono::steady_clock::now().time_since_epoch().count());
   rng = mt19937(rng() % (10018421) * N + p);
}

bool guess (unsigned long long A, int x) {
   auto bits = nbits(A), antibits = (N - 1) - bits;
   bool rez;
   
   auto a = rng() % (bits + antibits + 2) <= bits + 1;
   
   if(count((A << 1) | a, rez));
   else rez = rng() % (bits + antibits + 2) <= bits + 1;
   
   add((A << 1) | ((int)rez));
   
   cerr << bitset<6>(A) << ' ' << rez << '\n';
   
   return rez;
}

/**
      Istenem! Nu poate fi real.
-- Surse verificate
*/


詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

47 1 512
65536
59357300018926
96293527518067
137737813750604
78491116915335
88993654874821
78360968852287
2702630495168
114190034399180
83706287931245
55843777475204
63987647760479
11819697729154
76479374308061
97575794268961
13640589330115
19983697841730
74715951846822
13599519328054
61548920225107...

output:


result:


Test #2:

score: 0
Time Limit Exceeded

input:

48 1 1
65536
258400084282002
18817291621552
34157414175968
261341895829058
57721360254810
38139952911729
53122991565876
214222729945708
39585781480156
48503996366320
134007771804549
248553732684813
247186913037501
110017143518730
113208754435931
131680128766130
195535268670747
147744476202390
276072...

output:


result:


Test #3:

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

input:

3 0 1
8
0
1
2
3
4
5
6
7

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #4:

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

input:

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

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #5:

score: 1.35982
Acceptable Answer
time: 1ms
memory: 4212kb

input:

5 0 1
32
0
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

output:

JFIBEIIYTAFEUXOULOWO
0.353553

result:

points 0.3535530 Partially Correct!

Test #6:

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

input:

6 0 1
64
0
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

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #7:

score: 1.35982
Acceptable Answer
time: 1ms
memory: 4192kb

input:

7 0 1
128
0
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
99
...

output:

JFIBEIIYTAFEUXOULOWO
0.353553

result:

points 0.3535530 Partially Correct!

Test #8:

score: 0.740192
Acceptable Answer
time: 0ms
memory: 6224kb

input:

8 0 1
256
0
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
99
...

output:

JFIBEIIYTAFEUXOULOWO
0.192450

result:

points 0.192450 Partially Correct!

Test #9:

score: 1.35982
Acceptable Answer
time: 2ms
memory: 4292kb

input:

9 0 1
512
0
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
99
...

output:

JFIBEIIYTAFEUXOULOWO
0.353553

result:

points 0.3535530 Partially Correct!

Test #10:

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

input:

10 0 1
1024
0
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
9...

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #11:

score: 0
Wrong Answer
time: 4ms
memory: 6220kb

input:

11 0 1
2048
0
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
9...

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #12:

score: 0
Wrong Answer
time: 10ms
memory: 4908kb

input:

12 0 1
4096
0
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
9...

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #13:

score: 0
Wrong Answer
time: 16ms
memory: 6812kb

input:

13 0 1
8192
0
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
9...

output:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #14:

score: 0
Wrong Answer
time: 33ms
memory: 12412kb

input:

14 0 1
16384
0
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:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #15:

score: 0
Wrong Answer
time: 69ms
memory: 19776kb

input:

15 0 1
32768
0
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:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #16:

score: 0
Wrong Answer
time: 172ms
memory: 37192kb

input:

16 0 1
65536
0
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:

JFIBEIIYTAFEUXOULOWO
0

result:

wrong answer Wrong Answer!

Test #17:

score: 0
Time Limit Exceeded

input:

28 0 4096
65536
12151528
151281107
6356985
55622754
60790524
53095221
162774027
194726956
201380075
180643942
225783870
139946880
218528657
225747273
45233416
69963165
110071370
18713620
44573845
197368669
192189960
141638483
205070195
74240494
192234058
55620586
106561140
236994814
168337406
215313...

output:


result:


Test #18:

score: 0
Time Limit Exceeded

input:

29 0 512
65536
410980218
273986093
178466579
150072202
250912479
270586913
393616450
140036310
132749116
193167620
238207721
326701767
60326704
175391453
459652996
91592080
465308012
303071205
317027207
313954262
271839860
162796025
383149978
185842070
506111563
99795943
67286207
299755290
444249030...

output:


result:


Test #19:

score: 0
Time Limit Exceeded

input:

30 0 64
65536
214691366
235660933
597567210
280356575
393308773
32061236
891978407
203580173
963799529
818831701
435986085
699779062
393711419
235031222
190999512
651187471
263424929
403655957
709360404
520961430
84146157
915935067
839531745
598427362
31351715
260657569
651872369
657176264
286669978...

output:


result:


Test #20:

score: 0
Time Limit Exceeded

input:

31 0 1
65536
0
2147483647
1
2147483646
2
2147483645
4
2147483643
8
2147483639
16
2147483631
32
2147483615
64
2147483583
128
2147483519
256
2147483391
512
2147483135
1024
2147482623
2048
2147481599
4096
2147479551
8192
2147475455
16384
2147467263
32768
2147450879
65536
2147418111
131072
2147352575
26...

output:


result:


Test #21:

score: 0
Time Limit Exceeded

input:

32 0 1
65536
0
4294967295
0
1431655765
2863311530
4294967295
0
286331153
572662306
858993459
1145324612
1431655765
1717986918
2004318071
2290649224
2576980377
2863311530
3149642683
3435973836
3722304989
4008636142
4294967295
0
16843009
33686018
50529027
67372036
84215045
101058054
117901063
13474407...

output:


result:


Test #22:

score: 0
Time Limit Exceeded

input:

60 0 4096
65536
323063836466945924
793208291393593433
189732482682253627
339930035043069470
789975177022429968
414130113627522972
91354260708955341
246387313915805097
970513132875638428
12986596413062042
625318425426451677
353996229352655370
207780311111953778
34041113763273101
354089840612182482
43...

output:


result:


Test #23:

score: 0
Time Limit Exceeded

input:

61 0 512
65536
1269579383276536574
695100626888423752
1516888087373291385
62428637511494860
2066149187156155714
2191875477617107915
1990208032576906010
904462045833512333
1432974211708032269
1282245156402897867
2096783067184239171
2075613347620236839
1250324067295528212
47976314605632040
59849885805...

output:


result:


Test #24:

score: 0
Time Limit Exceeded

input:

62 0 64
65536
3579036048363638035
1601308923709322678
3797465667647602123
766217468233066219
450676595845310450
1532660195163344938
1771678237392312816
1676569536181862657
2613010877472702833
494389864650935313
2858087890091928221
2143267956909629504
395591804550444159
510332675328606646
41204665032...

output:


result:


Test #25:

score: 0
Time Limit Exceeded

input:

63 0 1
65536
0
9223372036854775807
0
1317624576693539401
2635249153387078802
3952873730080618203
5270498306774157604
6588122883467697005
7905747460161236406
9223372036854775807
0
72624976668147841
145249953336295682
217874930004443523
290499906672591364
363124883340739205
435749860008887046
50837483...

output:


result:


Test #26:

score: 0
Time Limit Exceeded

input:

64 0 1
65536
0
18446744073709551615
0
6148914691236517205
12297829382473034410
18446744073709551615
0
1229782938247303441
2459565876494606882
3689348814741910323
4919131752989213764
6148914691236517205
7378697629483820646
8608480567731124087
9838263505978427528
11068046444225730969
12297829382473034...

output:


result: