QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#324769 | #5533. Trick | tuanlinh123 | 0 | 15ms | 3660kb | C++20 | 2.7kb | 2024-02-10 23:53:34 | 2024-02-10 23:53:34 |
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";
};
auto init=[&](ll a, ll b, ll n)
{
for (ll s=0; s<=n*2+1; s++)
match[(a+s)%(n*2+1)][(b+s)%(n*2+1)]=s;
};
while (t--)
{
ll n; cin >> n;
if (n<=500)
{
if (n%2==0)
{
for (ll i=n*2; i>=n+2; i--)
init(i, n*2+1-i, n);
init(0, n*2, n), init(0, 1, n), init(n*2-3, n+1, n);
init(n, 2, n), init(n, n*2-1, n), init(4, n+1, n);
}
else
{
for (ll i=1; i<=n-1; i++)
init(i, n*2+1-i, n);
init(0, n*2, n), init(0, 1, n), init(n, 2, n);
init(n, n*2-1, n), init(4, n+1, n), init(n*2-3, n+1, n);
}
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: 15ms = 0ms + 15ms
memory: 0kb,3660kb
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 4 0 4 0 4 0 4 0 4 0 4 0 4 0 6 0 6 0 6 0 6 0 6 0 6 0 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 6 5 6 5 6 5 6 5 6 5 6 5 6 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 7 1 7 1 7 1 7 1 7 1 7 1 7 3 7 3 7 3 7 3 7 3 7 3 7 3 7 2 0 2 0 2 0 2 0 2 0 2 0 2 0 0 5 0 5 0 5 0 5 0 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 12 8 11 7 10 10 7 7 12 12 6 8 6 9 12 9 5 10 7 5 8 5 12 5 10 7 5 9 12 8 4 7 12 4 11 7 4 4 9 9 11 9 12 10 8 3 10 8 3 11 12 3 8 7 11 9 12 2 9 9 2 7 2 8 12 2 7 7 9 9 12 10 1 10 12 8 12 7 11 1 10 7 8 9 12 9 0 7 0 7 11 7 9 0 9 10 0 8 11 9 5 9 6 5 12 8 6 10 12 9 11 8 11 8 4 4 11 8 6 4 9 6 4 8 10 8 11 10 ...
input:
12012 3 6 0 4 9 12 6 0 4 8 11 6 0 4 7 10 6 0 4 10 7 6 0 4 7 12 6 0 4 12 6 6 0 4 8 6 6 0 6 9 12 6 0 6 9 5 6 0 6 10 7 6 0 6 5 8 6 0 6 5 12 6 0 6 5 10 6 0 6 7 5 6 2 6 9 12 6 2 6 8 4 6 2 6 7 12 6 2 6 4 11 6 2 6 7 4 6 2 6 4 9 6 2 6 9 11 6 4 6 9 12 6 4 6 10 8 6 4 6 3 10 6 4 6 8 3 6 4 6 11 12 6 4 6 3 8 6 4...
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:
wrong answer the card you returned is 6, but expected 0 (test case 1464)
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 6 10 7 0 9 1 7 8 10 3 0 8 3 7 6 1 11 7 1 13 10 0 4 1 11 13 3 14 11 13 3 6 14 9 0 1 2 9 14 13 15 16 5 3 12 4 6 15 14 8 13 0 15 0 15 15 9 9 2 12 15 1 16 0 8 12 8 0 12 10 13 5 0 1 14 18 12 2 12 12 11 18 0 14 5 14 5 11 6 0 10 17 6 0 5 0 18 19 3 0 20 2 18 5 7 0 8 0 18 2 20 12 21 4 13 2 4 5 21 17 22 5 ...
result:
Subtask #4:
score: 0
Skipped