QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#324755 | #5533. Trick | tuanlinh123 | 0 | 11ms | 3652kb | C++20 | 2.2kb | 2024-02-10 23:45:27 | 2024-02-10 23:45:27 |
Judging History
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;
mt19937_64 rng(170306);
ll random(ll l, ll r) {return l+rng()%(r-l+1);}
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]=rng()%(n*2+1);
if (type<=2) assistant_small(n);
else magician_small(n);
}
else
{
if (type<=2) assistant(n);
else magician(n);
}
}
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 11ms = 0ms + 11ms
memory: 0kb,3652kb
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:
0 2 3 2 5 4 3 4 0 6 4 6 3 2 1 3 4 1 0 2 0 6 1 6 0 6 2 1 1 6 0 6 1 3 1 5 4 1 0 2 4 5 2 5 4 2 0 2 1 0 0 1 5 0 1 6 4 3 1 0 5 4 1 5 0 2 4 6 0 5 0 4 4 5 0 2 0 2 5 2 1 2 1 5 5 3 1 6 2 3 2 1 3 7 4 1 1 0 0 4 2 3 4 3 0 1 1 2 0 7 1 0 0 1 1 2 0 1 2 0 1 7 1 4 4 2 0 5 1 5 3 5 0 7 4 0 1 7 1 0 1 5 0 5 0 4 2 7 0 2 ...
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 10 6 9 7 8 6 6 7 6 12 6 10 7 9 10 8 7 11 10 12 5 8 7 9 9 5 7 12 11 4 7 10 7 10 9 7 4 10 11 7 8 11 3 9 3 7 8 7 7 10 8 10 9 8 7 2 7 12 7 9 7 2 7 9 8 12 1 9 10 9 1 11 8 7 1 7 1 7 9 8 8 0 0 7 8 12 12 7 12 0 0 11 10 8 10 5 5 10 6 5 6 8 5 8 8 9 6 12 8 11 4 11 12 8 4 10 6 11 8 3 3 6 6 3 11 8 9 3 9 11 9...
input:
12012 3 6 0 2 7 9 6 3 2 10 6 6 5 4 9 7 6 3 4 8 6 6 0 6 6 7 6 4 6 6 12 6 3 2 6 10 6 1 3 7 9 6 4 1 10 8 6 0 2 7 11 6 0 6 10 12 6 1 6 5 8 6 0 6 7 9 6 2 1 9 5 6 1 6 7 12 6 0 6 11 4 6 1 3 7 10 6 1 5 7 10 6 4 1 9 7 6 0 2 4 10 6 4 5 11 7 6 2 5 8 11 6 4 2 3 9 6 0 2 3 7 6 1 0 8 7 6 0 1 7 10 6 5 0 8 10 6 1 6 ...
output:
10 9 4 4 0 7 0 12 8 2 11 3 1 9 4 7 3 11 4 7 1 11 4 5 1 1 7 11 12 10 9 12 0 6 7 9 11 4 11 10 10 7 10 12 5 6 9 10 8 6 6 3 8 9 1 5 1 2 0 12 9 7 8 12 8 4 4 6 10 12 6 10 11 10 6 3 10 8 0 9 2 1 10 9 7 4 1 5 3 12 9 7 12 10 2 8 11 0 0 9 9 12 11 9 1 4 9 3 0 6 9 1 12 0 2 4 3 1 9 6 4 8 4 7 8 7 6 6 3 4 0 7 5 1 ...
result:
wrong answer the card you returned is 10, but expected 6 (test case 1)
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:
10 11 1 6 0 10 1 12 9 10 2 0 0 6 2 0 0 1 8 12 1 13 14 0 13 1 1 13 10 14 8 14 10 8 0 11 1 13 2 1 10 14 7 5 0 1 0 4 15 13 8 1 10 9 0 16 14 9 7 2 2 12 17 8 6 3 17 9 18 10 8 10 15 18 4 7 16 10 2 1 12 20 1 18 13 15 5 16 11 5 1 7 17 7 4 16 1 13 11 16 15 9 0 19 18 5 12 9 20 22 18 0 1 11 12 13 4 22 20 11 20...
result:
Subtask #4:
score: 0
Skipped