Submission #00193


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include<bits/stdc++.h>
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const int MOD=(1e9)+7;
const int mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
#define EPS (1e-10)
#define eq(a,b) (fabs((a)-(b))<EPS)
class Point{
public:
double x,y;
Point(double x=0.0,double y=0.0):x(x),y(y){}
Point operator + (Point p){return(Point(x+p.x,y+p.y));}
Point operator - (Point p){return(Point(x-p.x,y-p.y));}
Point operator * (double a){return(Point(a*x,a*y));}
double abs(){return(sqrt(norm()));}
double norm(){return(x*x+y*y);}
bool operator < (const Point &p) const{
return (eq(x,p.x)?y<p.y:x<p.x);
}
bool operator > (const Point &p) const{
return (eq(x,p.x)?y>p.y:x>p.x);
}
bool operator == (const Point &p) const{
return (eq(x,p.x)&&eq(y,p.y));
}
};
typedef vector<Point> Polygon;
double dot(Point a,Point b){
return (a.x*b.x+a.y*b.y);
}
double cross(Point a,Point b){
return (a.x*b.y-a.y*b.x);
}
int contains(Polygon g,Point p);
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >>n;
Polygon P(n);
for(int i=0;i<n;i++){
Point p;
cin >>p.x>>p.y;
p=p*1.01;
P[i]=p;
}
int q;
cin >>q;
for(int i=0;i<q;i++){
Point p;
cin >>p.x>>p.y;
if(contains(P,p)!=0) cout <<"1\n";
else cout <<"0\n";
}
return (0);
}
int contains(Polygon g,Point p){
int n=g.size();
bool x=false;
for(int i=0;i<n;i++){
Point a=g[i]-p;
Point b=g[(i+1)%n]-p;
if(fabs(cross(a,b))<EPS&&dot(a,b)<EPS) return (1);
if(a.y>b.y) swap(a,b);
if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS) x=!x;
}
return (x?2:0);
}

ステータス

項目 データ
問題 0009 - 天空の城ツルガ
ユーザー名 保守性不在
投稿日時 2020-08-17 11:32:13
言語 C++17
状態 Wrong Answer
得点 0
ソースコード長 2266 Byte
最大実行時間 5000 ms
最大メモリ使用量 2828 KB

セット

セット 得点 Cases
1 ALL 0 / 11 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1 AC 28 ms 476 KB
1
in2 AC 19 ms 1156 KB
1
in3 AC 15 ms 1576 KB
1
in4 AC 23 ms 1896 KB
1
in5 WA 20 ms 1852 KB
1
in6 WA 19 ms 1936 KB
1
in7 WA 36 ms 2008 KB
1
in8 WA 37 ms 2088 KB
1
in9 WA 41 ms 2292 KB
1
in10 WA 40 ms 436 KB
1
in11 WA 41 ms 636 KB
1
in12 WA 41 ms 580 KB
1
in13 WA 43 ms 652 KB
1
in14 WA 38 ms 728 KB
1
in15 WA 52 ms 800 KB
1
in16 WA 52 ms 872 KB
1
in17 WA 44 ms 944 KB
1
in18 WA 51 ms 1012 KB
1
in19 WA 60 ms 1084 KB
1
in20 WA 61 ms 1232 KB
1
in21 WA 62 ms 1300 KB
1
in22 WA 59 ms 1368 KB
1
in23 WA 69 ms 1432 KB
1
in24 WA 30 ms 1504 KB
1
in25 WA 33 ms 1324 KB
1
in26 WA 31 ms 1388 KB
1
in27 WA 30 ms 1584 KB
1
in28 WA 32 ms 1656 KB
1
in29 WA 178 ms 1728 KB
1
in30 WA 185 ms 1660 KB
1
in31 WA 187 ms 1640 KB
1
in32 WA 197 ms 1624 KB
1
in33 WA 183 ms 1604 KB
1
in34 TLE 5000 ms 2480 KB
1
in35 TLE 5000 ms 2460 KB
1
in36 TLE 5000 ms 2628 KB
1
in37 TLE 5000 ms 2720 KB
1
in38 TLE 5000 ms 2828 KB
1