QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#399190 | #5533. Trick | sichengzhou | 29 | 7ms | 3956kb | C++14 | 2.2kb | 2024-04-26 01:27:18 | 2024-04-26 01:27:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=20;
int n,a[N],b[N];
int main()
{
int T,R;
scanf("%d%d",&T,&R);
if(R==1||R==2)
{
while(T--)
{
scanf("%d",&n);int s=0;
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
s+=a[i];
s%=(2*n+1);
}
for(int i=0;i<=2*n;i++)
{
b[i]=0;
}
for(int i=1;i<=n;i++)
{
if(b[(s+a[i])%(2*n+1)]==0)
{
b[(s+a[i])%(2*n+1)]=a[i];
}
}
for(int i=1;i<=n;i++)
{
if(b[3*a[i]%(2*n+1)])
{
printf("%d %d\n",a[i],b[3*a[i]%(2*n+1)]);
break;
}
}
}
}else{
int x,y,z,w;
while(T--)
{
scanf("%d%d%d%d%d",&n,&x,&y,&z,&w);
printf("%d\n",((-(3*x-y+3*z-w))%(2*n+1)+2*n+1)%(2*n+1));
}
}
for(int i=0;i<(1<<13);i++)
{
int cnt=0,s=0;
for(int j=0;j<13;j++)
{
if(i>>j&1)
{
cnt++;
s+=j;s%=13;
}else{
;
}
}
if(cnt==6)
{
bool fl=1;
for(int j=0;j<13;j++)
{
if((i>>j&1)==0)
{
continue;
}
for(int k=0;k<13;k++)
{
if(!(i>>k&1))
{
continue;
}
if((3*j-k+13)%13==s)
{
fl=0;break;
}
}
if(fl==0)break;
}
if(fl==0)
{
continue;
}
for(int j=0;j<13;j++)
{
if(i>>j&1)
{
cout<<j<<' ';
}
}
cout<<endl;
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 29
Accepted
Test #1:
score: 29
Accepted
time: 6ms = 0ms + 6ms
memory: 0kb,3828kb
input:
12012 1 6 0 1 2 3 4 5 6 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 7 12 11 12 9 7 0 7 9 10 5 12 11 6 6 5 6 6 10 6 5 5 9 10 4 10 4 12 6 6 11 9 6 8 6 9 9 10 3 8 3 10 3...
input:
12012 3 6 1 1 9 9 6 1 1 9 10 6 1 1 9 11 6 1 1 7 6 6 1 1 7 7 6 1 1 7 8 6 1 1 6 6 6 2 3 9 9 6 2 3 5 12 6 2 3 9 12 6 2 3 7 7 6 2 3 7 8 6 2 3 7 9 6 2 3 7 10 6 2 2 9 9 6 2 2 4 10 6 2 2 4 11 6 2 2 4 12 6 2 2 7 9 6 2 2 7 10 6 2 2 7 11 6 2 1 9 9 6 2 1 3 8 6 2 1 3 9 6 2 1 3 10 6 2 1 3 11 6 2 1 3 12 6 2 1 10 ...
output:
6 7 8 9 10 11 12 5 7 8 9 10 11 12 4 7 8 9 10 11 12 3 7 8 9 10 11 12 2 7 8 9 10 11 12 1 7 8 9 10 11 12 0 7 8 9 10 11 12 5 6 8 9 10 11 12 4 6 8 9 10 11 12 3 6 8 9 10 11 12 2 6 8 9 10 11 12 1 6 8 9 10 11 12 0 6 8 9 10 11 12 4 5 8 9 10 11 12 3 5 8 9 10 11 12 2 5 8 9 10 11 12 1 5 8 9 10 11 12 0 5 8 9 10 ...
result:
ok very good job! (12012 test cases)
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 7ms = 0ms + 7ms
memory: 0kb,3956kb
input:
6576 1 6 12 2 3 11 5 6 6 0 1 8 3 10 5 6 0 1 6 11 7 5 6 0 12 8 3 5 9 6 0 1 7 3 4 6 6 0 12 8 3 4 5 6 0 1 2 7 12 5 6 1 2 8 4 7 6 6 12 7 9 4 10 6 6 0 1 11 4 5 6 7 10 14 3 4 12 8 9 7 0 10 2 9 4 5 7 7 1 9 3 11 10 6 7 7 0 13 14 8 9 6 12 7 12 1 8 3 7 5 9 7 0 1 2 8 9 5 7 7 0 10 12 4 11 8 9 7 13 1 2 3 4 11 6 ...
output:
2 6 8 10 6 1 12 12 3 1 12 4 0 12 1 1 7 12 11 6 14 12 9 5 1 1 0 13 1 3 1 1 12 12 2 11 14 14 1 1 3 11 14 7 0 1 0 10 0 6 13 14 16 8 0 14 0 14 13 5 12 15 10 3 9 16 2 11 2 18 17 14 12 4 2 11 1 7 1 14 17 10 20 12 18 10 10 8 19 7 0 19 0 4 2 7 3 1 0 1 0 2 13 1 2 2 0 6 14 4 1 8 13 3 0 3 13 5 16 13 0 5 12 13 ...
input:
6576 2 6 1 4 7 8 9 10 6 2 4 7 9 11 12 6 2 3 4 9 10 12 6 1 2 6 7 10 11 6 2 5 8 9 10 12 6 1 2 6 9 10 11 6 3 4 6 8 9 10 6 3 5 9 10 11 12 6 0 1 2 5 8 11 6 2 7 8 9 10 12 7 0 1 5 6 7 11 13 7 1 3 8 11 12 13 14 7 2 4 5 8 12 13 14 7 1 2 4 5 7 10 11 7 0 2 4 6 10 11 14 7 3 4 6 10 11 12 13 7 1 3 5 6 7 13 14 7 0...
output:
7 8 7 2 10 3 6 7 2 12 2 6 3 8 3 11 1 2 2 10 1 5 1 1 2 8 2 11 2 4 3 10 1 14 0 7 8 9 2 7 0 16 4 12 9 3 2 8 3 12 8 3 7 3 7 1 4 11 3 15 0 4 1 11 0 3 5 3 5 15 1 13 1 2 4 8 5 15 5 6 4 3 1 14 2 9 1 15 0 17 1 16 2 9 1 16 4 5 3 16 6 5 0 21 3 4 3 17 5 10 4 5 0 17 5 22 1 3 4 12 3 16 7 16 2 2 0 10 5 16 1 15 12 ...
input:
6576 3 6 2 6 7 8 6 8 10 7 2 6 6 1 10 3 6 12 12 6 7 6 3 1 2 12 6 12 4 2 6 6 0 12 3 8 6 1 1 3 11 6 7 12 1 2 6 11 6 2 10 7 14 12 1 5 7 9 5 1 1 7 1 1 2 8 7 0 13 2 11 7 1 3 2 4 7 1 1 3 10 7 12 12 1 14 7 2 11 0 7 7 14 14 8 9 7 1 1 2 7 8 3 11 0 16 8 14 7 4 12 8 0 1 9 3 8 0 10 2 8 8 0 6 3 12 8 13 14 8 3 8 1...
output:
0 6 8 4 11 7 11 0 3 3 2 6 0 3 13 14 2 12 2 14 1 16 11 12 9 5 10 11 13 6 2 0 11 12 12 11 5 1 4 2 13 5 1 11 9 11 7 14 6 8 12 6 14 14 3 21 4 10 12 11 12 18 7 15 7 8 5 8 21 14 21 19 6 1 16 12 21 6 18 4 22 4 21 19 0 0 6 20 17 17 7 15 9 11 2 12 15 12 7 13 18 17 0 17 21 18 13 12 19 17 2 18 5 20 16 11 4 0 1...
result:
wrong answer the card you returned is 0, but expected 4 (test case 258)
Subtask #3:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 7ms = 0ms + 7ms
memory: 0kb,3956kb
input:
6525 1 6 10 1 11 3 12 6 6 1 7 10 12 5 6 6 0 10 12 7 9 8 6 12 1 8 4 7 11 6 11 8 9 4 10 6 6 0 7 2 3 4 5 6 0 8 3 10 11 6 6 0 1 2 4 7 6 6 0 1 11 9 5 6 6 7 1 12 8 6 5 7 0 1 13 10 12 5 6 7 0 14 2 3 4 12 6 7 11 1 3 8 12 6 13 7 0 1 2 3 13 5 14 7 11 9 10 8 4 14 7 7 0 8 14 3 4 13 11 7 0 10 2 14 8 5 6 7 0 13 2...
output:
1 12 1 1 10 10 1 12 11 11 0 5 3 10 0 6 11 1 7 8 0 13 0 4 12 12 2 13 9 9 14 4 2 6 0 13 1 2 1 14 13 8 16 12 4 14 0 12 0 2 8 3 1 3 11 16 12 12 2 9 2 2 1 4 17 3 9 17 5 5 9 6 15 17 0 2 2 10 0 12 12 3 0 3 14 1 2 7 15 5 0 16 1 2 1 12 5 6 16 6 3 21 0 2 18 2 12 7 0 4 0 14 20 3 12 8 14 22 20 11 20 5 0 15 17 2...
input:
6525 2 6 0 2 4 5 8 9 6 2 3 4 8 9 11 6 1 2 3 4 5 11 6 0 3 5 6 9 10 6 0 1 3 5 7 12 6 1 6 8 10 11 12 6 2 4 5 7 9 12 6 5 8 9 10 11 12 6 3 4 7 8 10 12 6 0 2 3 4 9 11 7 2 3 4 7 8 9 11 7 1 5 7 8 9 10 13 7 0 4 5 7 9 10 14 7 4 6 7 8 9 10 11 7 0 1 2 3 5 6 13 7 1 2 5 7 9 10 12 7 1 3 4 9 11 12 13 7 1 3 4 6 10 1...
output:
2 4 2 8 1 3 0 6 1 1 10 8 4 12 5 12 3 4 2 3 2 7 1 10 6 8 1 3 1 2 3 1 3 4 8 10 3 13 0 4 0 10 6 15 5 11 5 12 7 7 2 13 2 2 2 16 4 10 0 1 7 7 1 4 0 2 2 3 0 18 2 16 8 8 3 13 5 13 0 16 5 7 0 10 1 17 0 10 3 2 8 18 6 19 3 11 1 20 1 2 5 6 1 13 4 21 1 1 5 5 6 19 14 2 0 9 0 18 1 11 7 18 1 10 2 6 0 2 3 2 5 9 0 9...
input:
6525 3 6 1 12 2 4 6 1 1 2 8 6 10 10 1 3 6 1 12 0 6 6 11 11 1 1 6 0 5 10 8 6 3 10 4 12 6 0 6 5 12 6 11 1 3 4 6 7 8 2 3 7 0 13 2 7 7 0 4 1 10 7 12 12 6 8 7 2 13 1 3 7 9 9 1 2 7 14 4 3 1 7 2 6 3 4 7 0 13 8 10 7 1 2 3 13 7 1 14 0 4 8 13 8 0 10 8 16 12 6 15 8 4 14 5 11 8 0 12 5 12 8 0 2 7 7 8 8 3 2 13 8 ...
output:
7 0 6 2 2 9 1 3 2 10 14 11 11 7 11 14 10 14 3 0 13 12 15 9 5 3 13 10 8 4 1 2 11 6 8 8 13 6 2 9 1 13 15 11 16 10 0 11 8 20 3 12 3 15 17 15 18 4 21 5 11 22 16 6 12 11 9 2 22 18 10 14 7 17 22 1 8 14 5 8 9 16 3 21 11 10 4 18 20 3 4 20 2 1 21 21 20 3 16 20 15 18 11 10 9 10 22 11 2 2 15 17 22 0 5 18 2 14 ...
result:
wrong answer the card you returned is 11, but expected 2 (test case 13)
Subtask #4:
score: 0
Skipped