QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#412340 | #8669. 正方形计数 | ANIG | 0 | 1ms | 3656kb | C++14 | 1.2kb | 2024-05-16 12:03:36 | 2024-05-16 12:03:36 |
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=15;
const int inf=1e18;
int n,mnx=inf,mny=inf,mxx=-inf,mxy=-inf,res,x[N],y[N];
double S,eps=1e-7;
double gets(double a,double b,double c){
double k=(a+b+c)/2;
return sqrtl(k*(k-a)*(k-b)*(k-c));
}
double d(int x1,int y1,int x2,int y2){
return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
bool in(int xx,int xy){
double ans=0;
for(int i=2;i<=n;i++){
ans+=gets(d(xx,xy,x[i-1],y[i-1]),d(xx,xy,x[i],y[i]),d(x[i-1],y[i-1],x[i],y[i]));
}
ans+=gets(d(xx,xy,x[1],y[1]),d(xx,xy,x[n],y[n]),d(x[1],y[1],x[n],y[n]));
return abs(ans-S)<=eps;
}
signed main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>x[i]>>y[i];
}
for(int i=3;i<=n;i++){
S+=gets(d(x[1],y[1],x[i],y[i]),d(x[1],y[1],x[i-1],y[i-1]),d(x[i],y[i],x[i-1],y[i-1]));
}
int res=0;
for(int i=0;i<=10;i++){
for(int j=0;j<=10;j++){
for(int k=0;k<i;k++){
for(int t=j+1;t<=10;t++){
int a=t-j,b=i-k;
if(in(i,j)&&in(k,t)&&in(i-a,j-b)&&in(k-a,t-b))res++;
}
}
for(int k=i-1;k>=0;k--){
int a=i-k;
if(in(k,j-a)&&in(i,j)&&in(k,j)&&in(i,j-a))res++;
}
// cout<<i<<" "<<j<<" "<<in(i,j)<<endl;
}
}
cout<<res;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3656kb
input:
4 131 603 131 1828 1919 1828 1919 603
output:
0
result:
wrong answer 1st numbers differ - expected: '361182910200', found: '0'
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 1ms
memory: 3524kb
input:
3 131 603 131 1828 1919 603
output:
0
result:
wrong answer 1st numbers differ - expected: '63739309181', found: '0'
Subtask #3:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
8 0 13 4 15 15 15 15 6 13 1 12 0 5 0 0 6
output:
735
result:
wrong answer 1st numbers differ - expected: '4047', found: '735'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%