QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#458025 | #8669. 正方形计数 | q258233q | 0 | 0ms | 3912kb | C++14 | 1.6kb | 2024-06-29 15:24:26 | 2024-06-29 15:24:27 |
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using u64=unsigned long long;
//using lll=__int128_t;
using lf=long double;
using Pr=pair<int,int>;
#define F(i,l,r) for(ll i=l;i<=ll(r);++i)
#define G(i,r,l) for(ll i=r;i>=ll(l);--i)
#define ct const
#define il inline
#define pb push_back
#define fi first
#define se second
#define mkr make_pair
template<class T>
il void tomn(T&x,T ct&y){y<x?x=y,0:0;}
template<class T>
il void tomx(T&x,T ct&y){x<y?x=y,0:0;}
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define CUT dbg("===================\n")
ct lf EPS=1e-10L;
il int dcmp(lf x){return fabs(x)<=EPS?0:(x<0?-1:1);}
ct ll INF=4e18L;
//ct int INF=1.02e9;
//il void rd(int&x){scanf("%d",&x);}
//il void rd(ll&x){scanf("%lld",&x);}
ct ll P=1000000007;
void add2(ll&x,ll y){x+=y,x-=((-(x>=P))&P);}
void sub2(ll&x,ll y){x-=y,x+=((-(x<0))&P);}
ll add(ll x,ll y){return add2(x,y),x;}
ll sub(ll x,ll y){return sub2(x,y),x;}
struct Vec{int x,y;};
Vec operator-(Vec x,Vec y){return Vec{x.x-y.x,x.y-y.y};}
ll cross(Vec x,Vec y){return x.x*y.y-x.y*y.x;}
ct int N=10,M=15;
int n;
bool mp[M][M];
Vec p[N];
bool insi(Vec x){
F(i,1,n)if(cross(p[i]-p[i-1],x-p[i-1])>0)return 0;
return 1;
}
bool ck(int x,int y){return 0<=x&&x<M&&0<=y&&y<M&&mp[x][y];}
int main(){
#ifdef LOCAL
freopen("B.in","r",stdin);
// freopen(".out","w",stdout);
#endif
scanf("%d",&n);
F(i,1,n)scanf("%d%d",&p[i].x,&p[i].y);
p[0]=p[n];
F(x,0,M-1)F(y,0,M-1)mp[x][y]=insi(Vec{(int)x,(int)y});
int ans=0;
F(x,0,M-1)F(y,0,M-1)if(mp[x][y])F(i,1,M-1)F(j,0,M-1)
ans+=ck(x+i,y+j)&&ck(x+i-j,y+i+j)&&ck(x-j,y+i);
printf("%d\n",ans);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3912kb
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: 0ms
memory: 3852kb
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: 0ms
memory: 3908kb
input:
8 0 13 4 15 15 15 15 6 13 1 12 0 5 0 0 6
output:
3253
result:
wrong answer 1st numbers differ - expected: '4047', found: '3253'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%