QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#458057 | #8669. 正方形计数 | linrui# | 15 | 5ms | 3848kb | C++14 | 1.6kb | 2024-06-29 15:32:29 | 2024-06-29 15:32:30 |
Judging History
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{ll 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=55;
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("%lld%lld",&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{x,y});
int ans=0;
F(x,0,M-1)F(y,0,M-1)if(ck(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: 1ms
memory: 3848kb
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: 3732kb
input:
3 131 603 131 1828 1919 603
output:
0
result:
wrong answer 1st numbers differ - expected: '63739309181', found: '0'
Subtask #3:
score: 15
Accepted
Test #11:
score: 15
Accepted
time: 1ms
memory: 3672kb
input:
8 0 13 4 15 15 15 15 6 13 1 12 0 5 0 0 6
output:
4047
result:
ok 1 number(s): "4047"
Test #12:
score: 15
Accepted
time: 1ms
memory: 3760kb
input:
8 0 4 1 15 2 15 15 14 15 4 14 0 1 0 0 2
output:
4200
result:
ok 1 number(s): "4200"
Test #13:
score: 15
Accepted
time: 1ms
memory: 3668kb
input:
5 7 15 15 13 15 0 3 0 0 15
output:
3635
result:
ok 1 number(s): "3635"
Test #14:
score: 15
Accepted
time: 1ms
memory: 3672kb
input:
8 0 12 2 14 7 15 13 15 15 10 15 1 8 0 0 0
output:
4511
result:
ok 1 number(s): "4511"
Test #15:
score: 15
Accepted
time: 1ms
memory: 3780kb
input:
6 0 11 3 15 7 15 15 12 10 0 0 0
output:
3006
result:
ok 1 number(s): "3006"
Test #16:
score: 15
Accepted
time: 1ms
memory: 3784kb
input:
5 0 0 0 2 1 2 2 1 2 0
output:
4
result:
ok 1 number(s): "4"
Subtask #4:
score: 0
Wrong Answer
Dependency #3:
100%
Accepted
Test #17:
score: 0
Wrong Answer
time: 5ms
memory: 3716kb
input:
8 49 299 144 300 300 260 250 15 115 0 30 0 23 19 0 85
output:
240455
result:
wrong answer 1st numbers differ - expected: '443602646', found: '240455'
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%