QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#434894 | #8782. Schoolgirls | ucup-team1004# | WA | 2ms | 4224kb | C++14 | 1.2kb | 2024-06-08 17:50:16 | 2024-06-08 17:50:17 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const int N=1e5+10;
const ld PI=acos(ld(-1));
ld sq(ld x){return x*x;}
struct point{
ld x,y;
}p[N],a[N];
point operator +(point a,point b){return {a.x+b.x,a.y+b.y};}
point operator -(point a,point b){return {a.x-b.x,a.y-b.y};}
ld operator *(point a,point b){return a.x*b.y-a.y*b.x;}
ld dis(point a,point b){return sqrt(sq(a.x-b.x)+sq(a.y-b.y));}
bool chk(ld a,ld b)
{
return abs(a-b)<=1e-10;
}
bool chk(int n)
{
point s={0,0};
for(int i=1;i<=n;i++) s=s+a[i];
s.x/=n,s.y/=n;
ld cur=dis(s,a[1]);
for(int i=2;i<=n;i++)
if(!chk(dis(s,a[i]),cur)) return 0;
for(int i=2;i<=n;i++)
if(a[i].y<a[1].y) swap(a[i],a[1]);
sort(a+2,a+n+1,[](point x,point y){return (x-a[1])*(y-a[1])>0;});
cur=dis(a[1],a[2]),a[n+1]=a[1];
for(int i=2;i<=n;i++)
if(!chk(dis(a[i],a[i+1]),cur)) return 0;
return 1;
}
int n,m,Q;
int main()
{
scanf("%d%d%d",&n,&m,&Q);
for(int i=1;i<=n;i++)
p[i]=point{cos(i*PI*2/n),sin(i*PI*2/n)};
for(int i=1,x,y,z;i<=m;i++)
{
scanf("%d%d%d",&x,&y,&z);
p[i+n]=p[z]+p[x]-p[y];
}
while(Q--)
{
int k,x;
scanf("%d",&k);
for(int i=1;i<=k;i++) scanf("%d",&x),a[i]=p[x];
puts(chk(k)?"Yes":"No");
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4144kb
input:
3 6 8 1 2 3 3 1 4 5 4 3 3 1 2 4 5 3 4 5 2 6 4 7 6 5 1 2 3 1 3 2 3 1 1 8 4 2 5 6 7 3 2 1 4 3 6 5 9 3 4 7 9 4 1 3 2 8
output:
Yes Yes Yes No No No Yes No
result:
ok 8 token(s): yes count is 4, no count is 4
Test #2:
score: 0
Accepted
time: 1ms
memory: 4060kb
input:
12 0 1 12 12 11 10 9 8 7 6 5 4 3 2 1
output:
Yes
result:
ok YES
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 4224kb
input:
3 0 6685 5 1 3 1 2 2 3 1 2 3 5 3 1 3 3 1 4 1 1 1 3 3 3 2 1 5 2 3 2 1 3 6 2 2 3 2 3 1 5 3 1 2 3 2 3 3 3 2 5 3 2 2 2 3 5 2 2 3 3 1 6 3 3 1 3 1 3 6 2 3 3 2 2 1 5 2 2 3 2 2 6 2 3 3 2 1 3 6 2 2 2 2 1 3 3 3 1 2 4 3 2 1 1 5 3 1 3 2 3 4 3 1 1 2 4 2 2 2 3 3 1 2 2 4 2 3 3 1 3 2 2 2 4 1 2 2 3 3 3 3 3 4 1 3 1 3...
output:
No Yes No No Yes No No No No No No No No No No No Yes No No No No No No Yes No Yes No No No No No No No No No No No No Yes No No No No No No No No Yes No No No No No Yes No Yes No No No Yes No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No Yes No No No No No ...
result:
wrong answer expected NO, found YES [60th token]