QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#324739#5533. Tricktuanlinh1230 18ms3796kbC++202.1kb2024-02-10 23:39:122024-02-10 23:39:13

Judging History

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

  • [2024-02-10 23:39:13]
  • 评测
  • 测评结果:0
  • 用时:18ms
  • 内存:3796kb
  • [2024-02-10 23:39:12]
  • 提交

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;

ll base1=998244353, base2=1e9+7;
ll match[505][505];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t, type; cin >> t >> type;
    auto assistant_small=[&](ll n)
    {
        ll sum=0, Mod=n*2+1;
        vector <ll> a(n);
        for (ll& i:a) cin >> i, sum=(sum+i)%Mod;
        for (ll i=0; i<n; i++)
            for (ll j=0; j<n; j++)
                if (i!=j && match[a[i]][a[j]]==sum)
                {
                    cout << a[i] << " " << a[j] << "\n";
                    return;
                }
    };
    auto magician_small=[&](ll n)
    {
        ll Mod=n*2+1, fa1, fb1, fa2, fb2; cin >> fa1 >> fb1 >> fa2 >> fb2;
        ll sum=match[fa1][fb1]+match[fa2][fb2];
        sum=((n*2+1-sum)%Mod+Mod)%Mod; cout << sum << "\n";
    };
    auto assistant=[&](ll n)
    {
        ll sum=0, fa=0, fb=0, Mod=n*2+1; 
        vector <ll> a(n);
        for (ll& i:a) cin >> i, sum=(sum+i)%Mod;
        sort(a.begin(), a.end());
        for (ll i=0; i<n; i++)
            for (ll j=i+1; j<n; j++)
            {
                if ((a[i]+a[j])%Mod==sum) fa=a[i], fb=a[j];
                if ((a[i]+a[j]+n)%Mod==sum) fa=a[j], fb=a[i];
            }
        cout << fa << " " << fb << "\n";
    };
    auto magician=[&](ll n)
    {
        ll Mod=n*2+1, fa1, fb1, fa2, fb2; cin >> fa1 >> fb1 >> fa2 >> fb2;
        ll sum=(fa1<fb1?fa1+fb1:fa1+fb1+n)+(fa2<fb2?fa2+fb2:fa2+fb2+n);
        sum=((n*2+1-sum)%Mod+Mod)%Mod; cout << sum << "\n";
    };
    while (t--)
    {
        ll n; cin >> n;
        if (n<=500)
        {
            ll val=0;
            for (ll i=0; i<=n*2; i++)
                for (ll j=0; j<=n*2; j++)
                    match[i][j]=val=(val+base1)*base2%(n*2+1);
            if (type<=2) assistant_small(n);
            else magician_small(n);
        }
        else
        {
            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: 18ms = 0ms + 18ms
memory: 0kb,3796kb

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:

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

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:

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

input:

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

output:

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

result:

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

Subtask #2:

score: 0
Skipped

Subtask #3:

score: 0
Runtime Error

Test #11:

score: 0
Runtime Error

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:

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

result:


Subtask #4:

score: 0
Skipped