QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#24146 | #2947. Ball of Whacks | George_Plover | AC ✓ | 367ms | 3836kb | C++20 | 1.9kb | 2022-03-26 17:36:37 | 2022-04-30 05:08:25 |
Judging History
answer
#include <set>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int p[2][31]={
{0,2,3,4,5,1,7,8,9,10,6,13,14,15,16,17,18,19,20,11,12,22,23,24,25,21,27,28,29,30,26},
{0,6,11,12,7,2,20,21,13,3,1,25,26,27,22,14,8,4,5,10,19,30,28,15,9,18,24,29,23,16,17}
};
struct E{
int p[31];
void I()
{
for(int i=1;i<=30;i++)
p[i]=i;
}
}b[2];
E operator *(E a,E b)
{
E t=a;
for(int i=1;i<=30;i++)
a.p[i] = t.p[b.p[i]];
return a;
}
bool operator <(E x,E y)
{
for(int i=1;i<=30;i++)
if(x.p[i]!=y.p[i])
return x.p[i]<y.p[i];
return 0;
}
set<E> S;
int main()
{
for(int j=0;j<=1;j++)
for(int i=0;i<=30;i++)
b[j].p[i]=p[j][i];
S.insert(b[0]);
S.insert(b[1]);
b[1].I();
S.insert(b[1]);
while(1)
{
int cnt = S.size();
set<E> tmp;
for(auto &i: S)
for(auto &j: S)
tmp.insert(i*j);
for(auto &i:tmp)
S.insert(i);
if(S.size() == cnt)break;
}
int s[3][31];
for(int i=0;i<=2;i++)
{
scanf("%d",&s[i][0]);
for(int j=1;j<=s[i][0];j++)
scanf("%d",&s[i][j]);
}
if(s[0][0]+s[1][0]+s[2][0] != 30)
{
puts("No");return 0;
}
bool flag=0;
for(auto &i: S)
for(auto &j: S)
for(auto &k: S)
{
set<int> t;
for(int l=1;l<=s[0][0];l++)
t.insert(i.p[s[0][l]]);
for(int l=1;l<=s[1][0];l++)
t.insert(j.p[s[1][l]]);
for(int l=1;l<=s[2][0];l++)
t.insert(k.p[s[2][l]]);
if(t.size()==30)flag=1;
}
if(flag)
puts("Yes");
else
puts("No");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 220ms
memory: 3684kb
input:
10 1 2 3 4 5 6 7 8 9 10 10 1 2 7 13 22 28 29 24 18 10 10 1 2 3 4 5 6 7 8 9 10
output:
Yes
result:
ok single line: 'Yes'
Test #2:
score: 0
Accepted
time: 204ms
memory: 3644kb
input:
25 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 3 1 2 3 2 1 2
output:
Yes
result:
ok single line: 'Yes'
Test #3:
score: 0
Accepted
time: 192ms
memory: 3628kb
input:
24 1 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 30 5 1 2 3 4 5 1 1
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 204ms
memory: 3564kb
input:
25 1 11 26 25 30 24 17 18 10 19 20 6 27 16 15 23 29 28 22 13 7 14 8 3 2 2 1 6 3 1 5 10
output:
Yes
result:
ok single line: 'Yes'
Test #5:
score: 0
Accepted
time: 221ms
memory: 3780kb
input:
2 1 6 22 1 10 16 26 25 19 24 18 17 9 5 30 29 28 22 14 23 15 8 4 3 2 6 1 3 2 6 11 20
output:
Yes
result:
ok single line: 'Yes'
Test #6:
score: 0
Accepted
time: 178ms
memory: 3776kb
input:
14 1 19 10 5 9 16 13 14 15 8 4 12 7 3 15 1 26 30 25 24 16 9 17 18 10 19 20 6 2 7 1 1
output:
Yes
result:
ok single line: 'Yes'
Test #7:
score: 0
Accepted
time: 228ms
memory: 3628kb
input:
15 1 18 10 19 26 30 25 6 20 22 27 13 12 21 11 2 1 5 13 1 24 29 30 27 21 26 25 20 19 18 10 5
output:
Yes
result:
ok single line: 'Yes'
Test #8:
score: 0
Accepted
time: 367ms
memory: 3768kb
input:
2 1 5 4 1 2 7 12 24 1 4 5 10 19 20 9 17 18 24 16 3 14 8 15 23 28 29 30 25 26 27 22 13
output:
Yes
result:
ok single line: 'Yes'
Test #9:
score: 0
Accepted
time: 226ms
memory: 3780kb
input:
2 1 5 22 1 5 10 24 9 4 8 23 15 16 17 18 19 21 26 27 14 22 28 29 30 25 6 1 5 18 10 19 20
output:
Yes
result:
ok single line: 'Yes'
Test #10:
score: 0
Accepted
time: 197ms
memory: 3672kb
input:
24 1 2 25 24 29 30 26 3 5 4 9 17 16 14 8 15 23 28 27 22 13 7 12 21 3 1 10 5 3 1 5 10
output:
Yes
result:
ok single line: 'Yes'
Test #11:
score: 0
Accepted
time: 206ms
memory: 3688kb
input:
22 1 6 29 24 30 26 25 19 20 11 28 22 8 23 16 15 14 13 12 7 3 2 2 1 6 6 1 10 5 2 3 4
output:
Yes
result:
ok single line: 'Yes'
Test #12:
score: 0
Accepted
time: 200ms
memory: 3632kb
input:
18 1 7 12 21 11 20 30 25 19 24 17 18 10 5 4 3 2 6 7 1 9 15 8 4 5 10 5 1 6 2 3 4
output:
Yes
result:
ok single line: 'Yes'
Test #13:
score: 0
Accepted
time: 201ms
memory: 3832kb
input:
25 1 2 13 18 24 29 30 4 8 14 15 23 16 17 9 5 10 19 25 26 27 21 12 7 3 3 1 6 2 2 1 5
output:
Yes
result:
ok single line: 'Yes'
Test #14:
score: 0
Accepted
time: 188ms
memory: 3836kb
input:
8 1 10 19 20 25 30 24 18 21 1 4 3 2 7 12 13 28 22 14 8 15 23 16 24 17 9 5 10 18 19 1 1
output:
No
result:
ok single line: 'No'
Test #15:
score: 0
Accepted
time: 208ms
memory: 3728kb
input:
9 1 13 7 12 21 11 6 2 3 18 1 12 22 15 9 5 4 3 8 14 13 7 2 6 11 10 19 20 3 1 2 7
output:
No
result:
ok single line: 'No'
Test #16:
score: 0
Accepted
time: 202ms
memory: 3640kb
input:
23 1 5 10 18 19 27 26 22 28 8 15 7 2 3 4 9 24 17 16 23 29 30 25 2 1 2 5 1 2 7 12 13
output:
No
result:
ok single line: 'No'
Test #17:
score: 0
Accepted
time: 205ms
memory: 3636kb
input:
16 1 8 14 23 29 28 22 13 7 2 15 16 17 9 4 3 7 1 2 8 4 3 7 12 7 1 4 16 9 5 10 19
output:
No
result:
ok single line: 'No'
Test #18:
score: 0
Accepted
time: 222ms
memory: 3832kb
input:
3 1 6 2 21 1 2 6 3 27 16 15 23 28 8 14 22 13 7 12 21 11 20 25 19 10 6 1 3 13 7 2 6
output:
No
result:
ok single line: 'No'
Test #19:
score: 0
Accepted
time: 3ms
memory: 3780kb
input:
24 1 5 2 12 6 11 21 27 10 19 18 17 16 14 15 23 28 22 13 7 3 8 4 9 5 1 2 3 7 12 2 1 5
output:
No
result:
ok single line: 'No'
Test #20:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
23 1 5 19 10 18 16 11 20 25 26 30 24 17 6 2 7 3 29 23 15 8 4 9 7 1 11 6 20 19 25 2 1 1
output:
No
result:
ok single line: 'No'
Test #21:
score: 0
Accepted
time: 195ms
memory: 3680kb
input:
6 1 10 5 9 4 8 23 1 6 2 7 12 11 20 10 18 19 25 29 15 16 5 9 17 24 30 26 3 8 14 1 1
output:
No
result:
ok single line: 'No'
Test #22:
score: 0
Accepted
time: 193ms
memory: 3684kb
input:
6 1 11 6 2 12 7 23 1 5 10 11 26 21 12 15 14 13 27 22 28 23 16 8 4 9 17 29 30 24 18 1 1
output:
No
result:
ok single line: 'No'
Test #23:
score: 0
Accepted
time: 199ms
memory: 3688kb
input:
5 1 3 7 2 6 24 1 5 9 17 23 6 2 4 8 3 7 13 14 22 28 29 24 30 12 27 21 26 25 11 1 1
output:
No
result:
ok single line: 'No'
Test #24:
score: 0
Accepted
time: 249ms
memory: 3780kb
input:
9 1 22 13 14 15 8 4 3 2 8 1 21 12 11 6 25 20 19 13 1 2 3 4 5 6 7 8 9 10 11 12 13
output:
No
result:
ok single line: 'No'
Test #25:
score: 0
Accepted
time: 200ms
memory: 3688kb
input:
5 1 5 4 3 8 24 1 5 10 19 25 20 6 11 21 12 23 29 26 27 28 22 14 13 7 2 3 8 4 9 1 1
output:
No
result:
ok single line: 'No'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
1 1 3 1 10 5 25 1 5 21 27 23 19 26 25 10 17 18 24 30 29 28 22 13 14 15 16 9 4 8 3 7
output:
No
result:
ok single line: 'No'
Test #27:
score: 0
Accepted
time: 3ms
memory: 3732kb
input:
23 1 2 8 3 4 5 10 19 18 9 17 24 30 25 26 13 28 16 23 15 14 22 27 5 1 17 9 10 5 1 1
output:
No
result:
ok single line: 'No'
Test #28:
score: 0
Accepted
time: 211ms
memory: 3632kb
input:
28 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 1 1 1 1
output:
Yes
result:
ok single line: 'Yes'
Test #29:
score: 0
Accepted
time: 204ms
memory: 3688kb
input:
26 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 3 1 2 6 1 1
output:
No
result:
ok single line: 'No'