QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#324811#5533. Tricktuanlinh1230 7ms3764kbC++201.9kb2024-02-11 00:29:462024-02-11 00:29:46

Judging History

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

  • [2024-02-11 00:29:46]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:3764kb
  • [2024-02-11 00:29:46]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;

pll dif[3000005];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t, type; cin >> t >> type;
    auto assistant=[&](ll n)
    {
        ll sum=0, Mod=n*2+1;
        vector <ll> a(n), check(n*2+1, 0);
        for (ll& i:a) cin >> i, check[i]=1, sum=(sum+i)%Mod;
        cout << sum << "\n";
        for (ll i=0; i<=n*2; i++)
            if (dif[i].fi!=-1)
            {
                ll s=dif[i].fi+dif[i].se+sum*2;
                if (s%2!=i%2) s+=n*2+1;
                ll a=(s+i)/2, b=(s-i)/2;
                a=(a%Mod+Mod)%Mod, b=(b%Mod+Mod)%Mod;
                if (a!=b && check[a] && check[b])
                    {cout << a << " " << b << "\n"; return;}
            }
    };
    auto magician=[&](ll n)
    {
        ll Mod=n*2+1, fa1, fb1, fa2, fb2; cin >> fa1 >> fb1 >> fa2 >> fb2;
        ll d1=(fa1-fb1+Mod)%Mod, sum1=fa1-dif[d1].fi;
        ll d2=(fa2-fb2+Mod)%Mod, sum2=fa2-dif[d2].fi;
        cout << ((n*2+1-sum1-sum2)%Mod+Mod)%Mod << "\n";
    };
    while (t--)
    {
        ll n, Mod; cin >> n; Mod=n*2+1;
        for (ll i=0; i<=n*2; i++)
            dif[i]={-1, -1};
        auto init=[&](ll a, ll b) {dif[(a-b+Mod)%Mod]={a, b};};
        if (n%2==0)
        {
            for (ll i=n*2; i>=n+2; i--)
                init(i, n*2+1-i);
            init(0, n*2), init(0, 1), init(n*2-3, n+1);
            init(n, 2), init(n, n*2-1), init(4, n+1);
        }
        else
        {
            for (ll i=1; i<=n-1; i++)
                init(i, n*2+1-i);
            init(0, n*2), init(0, 1), init(n, 2);
            init(n, n*2-1), init(4, n+1), init(n*2-3, n+1);
        }
        if (type<=2) assistant(n);
        else magician(n);
    }
}

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,3588kb

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:

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

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:

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

input:

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

output:

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

result:

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

Subtask #2:

score: 0
Skipped

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 7ms = 0ms + 7ms
memory: 0kb,3764kb

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:

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

input:

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

output:

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

result:

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

Subtask #4:

score: 0
Skipped