QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#399192#5533. Tricksichengzhou0 8ms6012kbC++142.3kb2024-04-26 01:29:572024-04-26 01:29:57

Judging History

你现在查看的是最新测评结果

  • [2024-04-26 01:29:57]
  • 评测
  • 测评结果:0
  • 用时:8ms
  • 内存:6012kb
  • [2024-04-26 01:29:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e6+6;
LL K;
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;
            K=n/2;
            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[K*a[i]%(2*n+1)])
                {
                    printf("%d %d\n",a[i],b[K*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("%lld\n",((-(K*x-y+K*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: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 6ms = 0ms + 6ms
memory: 0kb,6012kb

input:

12012
1
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 5
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 4 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 6
6
0 1 2 3 5 ...

output:

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

input:

12012
2
6
7 8 9 10 11 12
6
6 8 9 10 11 12
6
6 7 9 10 11 12
6
6 7 8 10 11 12
6
6 7 8 9 11 12
6
6 7 8 9 10 12
6
6 7 8 9 10 11
6
7 8 9 10 11 12
6
5 8 9 10 11 12
6
5 7 9 10 11 12
6
5 7 8 10 11 12
6
5 7 8 9 11 12
6
5 7 8 9 10 12
6
5 7 8 9 10 11
6
7 8 9 10 11 12
6
4 8 9 10 11 12
6
4 7 9 10 11 12
6
4 7 8 1...

output:

9 9
9 10
9 11
7 6
7 7
7 8
6 6
9 9
5 12
9 12
7 7
7 8
7 9
7 10
9 9
4 10
4 11
4 12
7 9
7 10
7 11
9 9
3 8
3 9
3 10
3 11
3 12
10 8
9 9
8 11
2 7
2 8
2 9
2 10
2 11
9 9
8 12
7 10
7 11
1 7
1 8
1 9
9 9
11 9
7 11
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:

10
11
12
7
8
9
7
12
2
2
10
11
12
0
11
12
0
1
11
12
0
10
9
10
11
12
0
9
12
1
10
11
12
0
1
2
5
3
4
0
1
2
10
10
12
0
0
8
8
12
1
8
7
8
8
7
11
11
0
7
10
9
10
4
2
4
5
6
3
4
2
3
11
0
1
2
3
2
4
11
0
0
1
2
4
3
3
4
0
6
2
6
4
12
11
12
12
11
5
1
4
5
11
9
1
0
12
10
11
12
0
10
3
3
9
12
0
1
2
5
2
11
1
2
1
2
2
0
4
...

result:

wrong answer the card you returned is 10, but expected 6 (test case 1)

Subtask #2:

score: 0
Skipped

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 8ms = 0ms + 8ms
memory: 0kb,5972kb

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
14 8
1 2
14 7
0 12
0 2
2 4
15 9
11 10
1 14
16 16
12 6
10 3
2 17
9 7
18 5
17 9
15 13
0 2
2 12
0 12
3 3
0 3
14 8
5 5
11 15
0 16
10 7
16 5
7 5
3 15
19 15
0 2
17 10
14 18
0 4
0 14
2 22
12 9
13 22
2 7
15 20
0 1...

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
2 5
7 7
1 1
5 6
4 6
3 8
5 13
3 10
0 1
2 13
1 5
0 2
1 1
0 18
3 3
8 16
4 1
4 14
0 16
5 17
0 10
1 19
0 10
2 3
8 13
2 11
2 12
1 1
1 4
3 6
1 15
2 19
6 5
3 5
4 21
2 16
0 9
0 18
1 13
1 2
7 19
5 2
0 2
2 3
5 19
0 9
0 1...

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
14 8 0 10
8
1 2 2 5
8
14 7 7 7
8
0 12 1 1
8
0 2 5 6
8
2 4 4 6
8
15 9 3...

output:

3
9
0
5
12
0
9
5
5
11
5
14
5
1
11
5
10
8
0
3
1
7
14
13
8
10
0
6
7
0
0
8
0
8
4
12
10
3
7
9
20
13
6
15
18
8
18
17
6
19
21
17
6
0
9
12
15
18
17
20
22
11
11
11
20
18
19
12
15
20
15
1
17
4
3
16
11
19
11
0
15
10
16
1
14
4
4
16
3
3
9
20
7
16
5
13
9
10
16
15
7
15
9
20
14
11
1
21
17
2
4
6
14
9
12
5
10
6
6
12...

result:

wrong answer the card you returned is 3, but expected 7 (test case 1)

Subtask #4:

score: 0
Skipped