QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#474025 | #5090. 妙妙题 | Fffoooo | 100 ✓ | 1437ms | 180064kb | C++14 | 2.5kb | 2024-07-12 15:36:32 | 2024-07-12 15:36:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
/*
有 $n$ 个人,每个人可以看到其他所有人帽子的颜色
构造一种策略,表示当一个人看到其他人的帽子颜色是 $S$ 是做出的猜测是自己的帽子是黑/白
使得至少有 $\lfloor \dfrac{n-1}{2} \rfloor$ 个人猜中
$n\le 64$
函数性交互题
如果可以知道最终 $1$ 的个数是奇数还是偶数,那么每个人都可以猜出正确的答案
如果能找到一条划分,那么将左部的人认为总数是奇数,右部认为是偶数,那就可以达到一半的正确性
但是因为没有编号,所以只能通过看到的来判断这条线
那么在单位圆上,将这 $n$ 个点作为单位圆的 $n$ 等分点
将黑点对应的向量和算出,那么也得到了一条线
按照这一条线去算,首先白点不会有影响
那么对于黑点,相当于少了他自己的这一条向量。那么无论如何,他在向量的哪一侧是不会改变的(因为多的向量指向自己,不可能让整个向量直接超过180)
考虑特殊情况
如果发现与向量共线,那么就直接猜测是黑点
如果发现是零向量,那么直接猜是白点
首先这样可以过掉黑白交替的情况
然后对于普通情况,如果贡献的两个点都是白点,那么只会损失 $2$ 的正确率,还是可以满足条件
如果发现零向量的是黑点,那么就只能说明这一条向量原本就是指向他的,因此只有他会错
*/
const int NN = 67;
const double eps = 1e-10;
const double pi = acos(-1);
int n;
int sgn( const double x ) { return ( x > eps ) ? 1 : ( x < -eps ? -1 : 0 ); }
struct Point {
double x, y;
friend Point operator + (const Point a, const Point b) { return (Point) { a.x + b.x, a.y + b.y }; }
friend Point operator - (const Point a, const Point b) { return (Point) { a.x - b.x, a.y - b.y }; }
friend double operator % (const Point a, const Point b) { return a.x * b.y - a.y * b.x ; }
}p[NN];
void init(int N, bool Type, int p) {
n = N;
const double alpha = 2.0 * pi / (double)n;
for(int i = 0; i < n; ++i) ::p[i].x = cos( alpha * i ), ::p[i].y = sin( alpha * i );
}
bool guess( unsigned long long A, int x ) {
Point xf = (Point){0, 0};
bool sum = false;
for(int i = 0; i < n - 1; ++i) if( A & ( 1ull << i ) ) xf = xf + p[i], sum ^= 1;
if( !sgn( xf.x ) and !sgn( xf.y ) ) return false;
const int xm = sgn( xf % p[n - 1] );
if( !xm ) return true;
if( xm > 0 ) return sum ^ 1;
return sum;
}
详细
Test #1:
score: 3.84615
Accepted
time: 909ms
memory: 142984kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #2:
score: 3.84615
Accepted
time: 929ms
memory: 143356kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #3:
score: 3.84615
Accepted
time: 0ms
memory: 4136kb
input:
3 0 1 8 0 1 2 3 4 5 6 7
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #4:
score: 3.84615
Accepted
time: 0ms
memory: 4080kb
input:
4 0 1 16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #5:
score: 3.84615
Accepted
time: 0ms
memory: 4204kb
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 1.000000
result:
ok Accepted!
Test #6:
score: 3.84615
Accepted
time: 0ms
memory: 4216kb
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 1.000000
result:
ok Accepted!
Test #7:
score: 3.84615
Accepted
time: 0ms
memory: 4260kb
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 1.000000
result:
ok Accepted!
Test #8:
score: 3.84615
Accepted
time: 1ms
memory: 4204kb
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 1.000000
result:
ok Accepted!
Test #9:
score: 3.84615
Accepted
time: 1ms
memory: 4340kb
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 1.000000
result:
ok Accepted!
Test #10:
score: 3.84615
Accepted
time: 1ms
memory: 4304kb
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 1.000000
result:
ok Accepted!
Test #11:
score: 3.84615
Accepted
time: 3ms
memory: 4316kb
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 1.000000
result:
ok Accepted!
Test #12:
score: 3.84615
Accepted
time: 6ms
memory: 5228kb
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 1.000000
result:
ok Accepted!
Test #13:
score: 3.84615
Accepted
time: 8ms
memory: 6924kb
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 1.000000
result:
ok Accepted!
Test #14:
score: 3.84615
Accepted
time: 23ms
memory: 12280kb
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 1.000000
result:
ok Accepted!
Test #15:
score: 3.84615
Accepted
time: 54ms
memory: 18832kb
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 1.000000
result:
ok Accepted!
Test #16:
score: 3.84615
Accepted
time: 119ms
memory: 35188kb
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 1.000000
result:
ok Accepted!
Test #17:
score: 3.84615
Accepted
time: 400ms
memory: 83784kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #18:
score: 3.84615
Accepted
time: 415ms
memory: 87804kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #19:
score: 3.84615
Accepted
time: 447ms
memory: 88852kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #20:
score: 3.84615
Accepted
time: 469ms
memory: 92452kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #21:
score: 3.84615
Accepted
time: 469ms
memory: 92712kb
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:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #22:
score: 3.84615
Accepted
time: 1342ms
memory: 172680kb
input:
60 0 4096 65536 323063836466945924 793208291393593433 189732482682253627 339930035043069470 789975177022429968 414130113627522972 91354260708955341 246387313915805097 970513132875638428 12986596413062042 625318425426451677 353996229352655370 207780311111953778 34041113763273101 354089840612182482 43...
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #23:
score: 3.84615
Accepted
time: 1393ms
memory: 177008kb
input:
61 0 512 65536 1269579383276536574 695100626888423752 1516888087373291385 62428637511494860 2066149187156155714 2191875477617107915 1990208032576906010 904462045833512333 1432974211708032269 1282245156402897867 2096783067184239171 2075613347620236839 1250324067295528212 47976314605632040 59849885805...
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #24:
score: 3.84615
Accepted
time: 1437ms
memory: 180064kb
input:
62 0 64 65536 3579036048363638035 1601308923709322678 3797465667647602123 766217468233066219 450676595845310450 1532660195163344938 1771678237392312816 1676569536181862657 2613010877472702833 494389864650935313 2858087890091928221 2143267956909629504 395591804550444159 510332675328606646 41204665032...
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #25:
score: 3.84615
Accepted
time: 1312ms
memory: 176996kb
input:
63 0 1 65536 0 9223372036854775807 0 1317624576693539401 2635249153387078802 3952873730080618203 5270498306774157604 6588122883467697005 7905747460161236406 9223372036854775807 0 72624976668147841 145249953336295682 217874930004443523 290499906672591364 363124883340739205 435749860008887046 50837483...
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!
Test #26:
score: 3.84615
Accepted
time: 1341ms
memory: 178764kb
input:
64 0 1 65536 0 18446744073709551615 0 6148914691236517205 12297829382473034410 18446744073709551615 0 1229782938247303441 2459565876494606882 3689348814741910323 4919131752989213764 6148914691236517205 7378697629483820646 8608480567731124087 9838263505978427528 11068046444225730969 12297829382473034...
output:
JFIBEIIYTAFEUXOULOWO 1.000000
result:
ok Accepted!