QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#473903 | #5090. 妙妙题 | XiaoShanYunPan | 100 ✓ | 1653ms | 178904kb | C++14 | 1.8kb | 2024-07-12 14:55:42 | 2024-07-12 14:55:42 |
Judging History
answer
/*
集训队互测2022 妙妙题
确实妙妙题。
考虑把人分成两组,一组认为黑帽子总数是奇数,另一组则认为是偶数。
现在不知道编号没法分组怎么办?
通过已知信息构造一个分组方案,怎么搞呢?
把桌子变成一个单位圆,每个人都是一个向量。
黑帽子的向量全部相加即可得到一条线,这条线的左右两边分成两组即可。
注意到如果自己是黑帽子,那么线不太对,怎么办?
这个容易解决,发现其实并不影响左右。
有时候线退化成点,怎么办?
这个时候选白帽子,可以感受到此时大部分人都是白帽子,否则那些黑帽子的仍然能够分组。
我要是站在线中间,怎么办?
这个时候反而要选黑帽子,因为其他人两两平衡了,你和对面的却没有。
分析一下这时候确实可能会错,但是因为你选择了黑帽子,所以至多错两个,你错了的时候其他人都不错。
然后就恰好符合要求,出题人细啊。
*/
#include<bits/stdc++.h>
#include "tmp.h"
using namespace std;
using Vector=complex<double>;
double PI=acos(-1.0),eps=1e-6;
int n;
void init(int N,bool Type,int p){n=N;return;}
inline int sgn(double x)
{
if(x<-eps)return -1;
if(x>eps)return 1;
return 0;
}
inline int clockwise(Vector p,Vector q)
{
double ret=p.real()*q.imag()-q.real()*p.imag();
return sgn(ret);
}
bool guess(unsigned long long A,int x)
{
Vector omega(cos(PI*2/n),sin(PI*2/n));//n次单位根
Vector now=omega,sum(0,0);
int black_cnt=0;
for(int i=1;i<n;i++)
{
bool t=(A>>(i-1))&1;
if(t)sum+=now,black_cnt++;
now*=omega;
}
int cl=clockwise(sum,now);
if(sgn(sum.real())==0&&sgn(sum.imag())==0)return 0;//退化为点
if(cl==1)return black_cnt&1;
if(cl==-1)return (black_cnt&1)^1;
if(cl==0)return 1;//共线
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 3.84615
Accepted
time: 1081ms
memory: 141216kb
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: 1065ms
memory: 142580kb
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: 4164kb
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: 4132kb
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: 4260kb
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: 4136kb
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: 4188kb
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: 4352kb
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: 4308kb
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: 4304kb
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: 7152kb
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: 12ms
memory: 6892kb
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: 10284kb
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: 55ms
memory: 17836kb
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: 123ms
memory: 33328kb
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: 455ms
memory: 82752kb
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: 481ms
memory: 85532kb
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: 496ms
memory: 88164kb
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: 515ms
memory: 90072kb
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: 555ms
memory: 92384kb
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: 1578ms
memory: 172612kb
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: 1578ms
memory: 175436kb
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: 1653ms
memory: 178324kb
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: 1506ms
memory: 175740kb
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: 1555ms
memory: 178904kb
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!