QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#253599 | #7800. Every Queen | Lynkcat# | WA | 1ms | 3572kb | C++20 | 1.6kb | 2023-11-17 09:45:02 | 2023-11-17 09:45:02 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N
using namespace std;
const int N=100005;
map<int,int>cnt0,cnt1,cnt2,cnt3;
map<pa,int>Mp;
int ans,ax,ay;
int n,x[N],y[N];
void chk(int x,int y)
{
if (ans) return;
int t=0;
if (cnt0.count(x)) t+=cnt0[x];
if (cnt1.count(y)) t+=cnt1[y];
if (cnt2.count(x-y)) t+=cnt2[x-y];
if (cnt3.count(x+y)) t+=cnt3[x+y];
if (Mp.count(mp(x,y))) t-=3;
if (t==n) ans=1,ax=x,ay=y;
}
void BellaKira()
{
cin>>n;
for (int i=1;i<=n;i++)
cin>>x[i]>>y[i],cnt0[x[i]]++,cnt1[y[i]]++,cnt2[x[i]-y[i]]++,cnt3[x[i]+y[i]]++,Mp[mp(x[i],y[i])]++;
ans=0,ax=0,ay=0;
for (int i=1;i<=n;i++)
chk(x[i],y[i]);
for (int i=2;i<=n;i++)
{
chk(x[1],y[i]);
chk(x[i],y[1]);
int d;
d=abs(x[i]-x[1]);
chk(x[1],y[i]+d);
chk(x[1],y[i]-d);
d=abs(y[i]-y[1]);
chk(x[i]+d,y[1]);
chk(x[i]-d,y[1]);
}
if (ans) cout<<"YES\n"<<ax<<" "<<ay<<'\n';
else cout<<"NO\n";
cnt0.clear(),cnt1.clear(),cnt2.clear(),cnt3.clear();
Mp.clear();
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
cin>>T;
while (T--)
{
BellaKira();
}
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
3 2 1 1 2 2 4 0 1 1 0 3 1 4 0 5 0 1 1 0 1 2 2 2 4 2
output:
YES 1 1 NO YES 1 2
result:
ok OK (3 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
1 4 -100000000 -100000000 100000000 -100000000 -100000000 100000000 100000000 100000000
output:
YES -100000000 -100000000
result:
ok OK (1 test case)
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3572kb
input:
330 3 5 1 -3 -5 -2 2 2 1 4 4 0 4 2 -5 3 -3 -5 4 2 -2 2 -4 1 2 4 1 1 5 4 3 5 -2 3 5 2 -3 -3 5 -3 -4 2 -1 -2 -2 1 0 -1 -5 5 4 -3 -2 -4 2 2 0 -5 -4 -3 4 0 0 -3 -5 0 5 5 0 1 1 -1 5 0 2 3 4 1 4 4 5 5 0 3 -4 -5 -5 -3 5 -5 3 -1 2 -4 -4 -1 5 4 1 1 4 5 -1 0 5 2 1 -3 2 5 5 0 4 1 -3 -5 3 -3 0 0 5 0 1 -5 4 -5 5...
output:
YES 5 -5 YES 1 0 YES 2 -3 YES -4 4 YES 1 5 NO NO NO YES 0 -5 YES 1 -1 NO YES -5 -5 YES -1 -4 YES 1 2 YES -3 2 NO NO YES -3 2 YES -5 -3 YES -2 0 NO YES 2 0 NO NO NO YES 1 5 YES -5 -2 NO NO YES 5 -4 NO YES 4 3 YES 3 5 YES -1 3 YES -5 1 NO NO YES 3 -2 YES 2 4 YES 1 -4 YES -2 -5 NO YES 1 -5 YES 1 4 YES ...
result:
wrong answer Jury found solution, but participant did not (test case 17)