QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#458446#8669. 正方形计数linrui#35 569ms4060kbC++141.6kb2024-06-29 17:22:002024-06-29 17:22:01

Judging History

你现在查看的是最新测评结果

  • [2024-06-29 17:22:01]
  • 评测
  • 测评结果:35
  • 用时:569ms
  • 内存:4060kb
  • [2024-06-29 17:22:00]
  • 提交

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=305;
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});
	ll ans=0;
	F(x,0,M-1)F(y,0,M-1)if(ck(x,y))F(i,1,M-x)G(j,min(x,M-y-i-1),0)
		ans+=(mp[x+i][y+j]&mp[x+i-j][y+i+j]&mp[x-j][y+i]);
	printf("%lld\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: 3928kb

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: 3880kb

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: 3924kb

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: 0
Accepted
time: 1ms
memory: 4012kb

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: 0
Accepted
time: 1ms
memory: 3932kb

input:

5
7 15
15 13
15 0
3 0
0 15

output:

3635

result:

ok 1 number(s): "3635"

Test #14:

score: 0
Accepted
time: 1ms
memory: 4016kb

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: 0
Accepted
time: 0ms
memory: 4020kb

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: 0
Accepted
time: 0ms
memory: 4020kb

input:

5
0 0
0 2
1 2
2 1
2 0

output:

4

result:

ok 1 number(s): "4"

Subtask #4:

score: 20
Accepted

Dependency #3:

100%
Accepted

Test #17:

score: 20
Accepted
time: 527ms
memory: 4016kb

input:

8
49 299
144 300
300 260
250 15
115 0
30 0
23 19
0 85

output:

443602646

result:

ok 1 number(s): "443602646"

Test #18:

score: 0
Accepted
time: 426ms
memory: 4060kb

input:

8
0 133
103 300
130 300
257 294
297 227
300 150
277 40
161 4

output:

351466521

result:

ok 1 number(s): "351466521"

Test #19:

score: 0
Accepted
time: 569ms
memory: 4008kb

input:

8
76 286
114 300
300 300
300 205
291 0
47 0
4 57
2 235

output:

605026927

result:

ok 1 number(s): "605026927"

Test #20:

score: 0
Accepted
time: 550ms
memory: 4008kb

input:

8
0 102
40 274
282 300
300 234
267 0
34 0
6 57
0 86

output:

497330741

result:

ok 1 number(s): "497330741"

Test #21:

score: 0
Accepted
time: 499ms
memory: 4020kb

input:

7
0 288
156 300
212 300
265 176
300 86
278 0
0 36

output:

446722651

result:

ok 1 number(s): "446722651"

Subtask #5:

score: 0
Wrong Answer

Dependency #4:

100%
Accepted

Test #22:

score: 0
Wrong Answer
time: 487ms
memory: 3924kb

input:

5
257 800
766 800
800 353
667 0
42 0

output:

340513585

result:

wrong answer 1st numbers differ - expected: '18881369614', found: '340513585'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%