QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#630775 | #4383. Laser | qq0121 | AC ✓ | 58ms | 4992kb | C++20 | 1.6kb | 2024-10-11 20:21:59 | 2024-10-11 20:22:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int,int>
const int N=5e5+10;
const int mod=998244353;
int n,m;
int k;
// vector<PII>v;
void solve()
{
cin>>n;
int a,b;
vector<array<int,2>>p(n);
for(int i=0;i<n;i++)
{
cin>>a>>b;
p[i]={a*2,b*2};
}
auto check=[&](int x0,int y0)->int
{
for(auto [x,y]:p)
{
if(x==x0||y==y0||y-y0==x-x0||y-y0==x0-x)
{
continue;
}
return 0; //不满足
}
return 1;
};
auto [x0,y0]=p[0];
for(int i=1;i<n;i++)
{
auto [x,y]=p[i];
if(x0==x||y0==y||x0+y0==x+y||x0-x==y0-y)//在(x0,y0)点情况下所有点满足
{
continue;
}
if(check(x0+y0-y,y)||check(x0,y+(x-x0))||check(x0,y)||check(x0+y-y0,y)||check(x+y-y0,y0)||check(x,y0)||check(x-y+y0,y0)||check(x,y0-(x-x0))||check(x0,y-x+x0)||check(x,y0+(x-x0))||check((x0+x+y0-y)/2,(x0-x+y0+y)/2)||check((x0+x+y-y0)/2,(x-x0+y0+y)/2))
{
//如果这两个点不满足,判断中间能形成米子在他俩之间的点是否可以,总共12种情况
cout<<"YES"<<"\n";
return ;
}else
{
cout<<"NO"<<"\n";
return ;
}
}
cout<<"YES"<<'\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T=1;
cin>>T;
while(T--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 58ms
memory: 4992kb
input:
116 4 -10 0 10 0 5 5 -5 -5 4 -10 0 10 0 0 10 0 -10 4 -1 0 1 0 2 0 3 0 4 0 1 0 2 0 3 0 4 4 100 100 10000 10000 100000 100000 -100 -100 4 -100 100 -10000 10000 -100000 100000 100 -100 6 1 1 1 3 2 2 3 1 3 3 3 4 7 1 1 1 3 2 2 3 1 3 3 1 4 3 4 4 1236833 14678 1232056 9901 1237055 9790 1231834 15011 4 1236...
output:
YES YES YES YES YES YES YES NO YES NO NO YES NO NO YES YES NO NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES NO YES YES NO NO YES NO NO NO YES YES YES NO NO YES YES NO NO NO NO NO YES YES NO YES NO NO YES NO YES NO NO NO NO YES YES YES NO YES YES YES NO YES YES NO YES NO YES YES NO YES NO...
result:
ok 116 lines