CSES - Datatähti Open 2019 - Results
Submission details
Task:Function
Sender:Rudy358
Submission time:2019-01-18 17:58:10 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.02 s1details
#20.02 s1details
#30.01 s1details
#40.02 s1details
#50.12 s1details
#60.03 s1details
#70.02 s1details
#80.05 s1details
#90.02 s1details
#100.01 s2details
#110.04 s2details
#120.02 s2details
#130.01 s2details
#140.12 s2details
#150.12 s2details
#160.12 s2details
#170.13 s2details
#180.09 s2details
#190.09 s2details
#200.09 s2details
#210.02 s2details
#220.00 s2details
#230.00 s2details
#240.00 s2details
#250.00 s2details
#260.00 s2details
#270.00 s2details
#280.00 s2details
#290.00 s2details
#300.02 s2details
#310.01 s2details
#320.01 s2details
#330.02 s2details
#340.13 s2details
#350.00 s2details

Code

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pi>
#define vpl vector<pl>
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int t,n,l,r;

pi p[1000005];

long double a[1000005],eps=0.0000000000000001,PI=acos(-1),d;

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
#ifdef LOCAL_DEFINE
	ifstream cin("input.in");
#endif
	cout << fixed << setprecision(20);
	cin >> t;
	while(t--){
		cin >> n;
		for(int i=1;i<=n;i++) cin >> p[i].x >> p[i].y;
		for(int i=1;i<n;i++){
			if(p[i].y!=p[i+1].y) a[i]=atan((double)(p[i+1].x-p[i].x)/(p[i+1].y-p[i].y));
			else if(p[i+1].x>p[i].x) a[i]=PI/2;
			else a[i]=-PI/2;
			if(a[i]<-eps) a[i]+=PI;
			if(p[i+1].x<p[i].x) a[i]+=PI;
			else if(p[i].x==p[i+1].x && p[i].y>p[i+1].y) a[i]+=PI;
			//cout << a[i]*180/PI << '\n';
		}
		int pos=0;
		sort(a+1,a+n);
		for(int i=1;i<n;i++){
			cout << a[i] << ' ';
			if(a[i]-PI<-eps){
				l=i-1; if(l<1) l=n-1;
				r=i+1; if(r>n-1) r=1;
				if(a[l]-a[i]>eps && a[l]-a[i]-PI<-eps) pos=1;
				if(a[r]-a[i]<-eps || a[r]-a[i]-PI>eps) pos=1;
			}
			else{
				l=i-1; if(l<1) l=n-1;
				r=i+1; if(r>n-1) r=1;
				if(a[l]-a[i]>eps || a[l]-a[i]+PI<-eps) pos=1;
				if(a[r]-a[i]<-eps && a[r]-a[i]+PI>eps) pos=1;
			}
		}
		if(n==2) pos=1;
		//cout << mx << '\n';
		//cout << mx-mn-PI << '\n';
		if(pos) cout << "YES\n";
		else cout << "NO\n";
	}
	
#ifdef LOCAL_DEFINE
	cerr << "\nTime elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << " \n";
#endif
}

Test details

Test 1

Group: 1

Verdict:

input
12
2
0 0
1 1
5
...

correct output
YES
YES
NO
YES
YES
...

user output
0.78539816339744827900 YES
0.09966865249116203807 0.09966...
Truncated

Test 2

Group: 1

Verdict:

input
100
2
92 30
22 44
2
...

correct output
YES
YES
YES
YES
YES
...

user output
4.90978454023457033806 YES
1.56412975889102834337 YES
1.28474488507757844680 YES
5.1927947

...
Truncated

Test 3

Group: 1

Verdict:

input
100
3
-55 -98
-59 -55
-2 88
...

correct output
YES
YES
YES
YES
YES
...

user output
0.37930010507983263901 6.19042...
Truncated

Test 4

Group: 1

Verdict:

input
100
4
87 81
-84 42
18 -46
...

correct output
YES
YES
YES
YES
YES
...

user output
2.28264319970380502589 4.48815...
Truncated

Test 5

Group: 1

Verdict:

input
100
1000
-81 38
92 -21
-10 -65
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 6

Group: 1

Verdict:

input
100
110
-99 -9
-98 -9
-96 -8
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 7

Group: 1

Verdict:

input
100
78
-100 95
-99 96
-98 95
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 8

Group: 1

Verdict:

input
100
201
-100 97
-100 96
-99 99
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 9

Group: 1

Verdict:

input
100
45
-100 89
-100 90
-97 90
...

correct output
YES
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 10

Group: 2

Verdict:

input
13
2
0 0
1 1
5
...

correct output
YES
YES
NO
YES
YES
...

user output
0.78539816339744827900 YES
0.09966865249116203807 0.09966...
Truncated

Test 11

Group: 2

Verdict:

input
100
2
-517113909 -39540276
-209411537 -831819487
2
...

correct output
YES
YES
YES
YES
YES
...

user output
2.77114679920738055108 YES
0.36586987062119374903 YES
2.85940174941040387013 YES
5.7068671

...
Truncated

Test 12

Group: 2

Verdict:

input
100
3
-991349544 139282777
646238126 16140762
-4488261 817588303
...

correct output
YES
YES
YES
YES
YES
...

user output
1.64585227310453419136 5.60120...
Truncated

Test 13

Group: 2

Verdict:

input
100
4
891187584 -889373775
-453505448 -469134344
-683807769 8725517
...

correct output
YES
NO
YES
NO
NO
...

user output
0.41063281561275988274 5.01528...
Truncated

Test 14

Group: 2

Verdict:

input
100
1000
-866614983 -994037153
775605588 -328510132
390868551 927606059
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00147484233159018248 0.01131...
Truncated

Test 15

Group: 2

Verdict:

input
100
1000
-911073332 -1000000000
-905159999 -1000000000
-904949593 -999999999
...

correct output
YES
YES
YES
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 16

Group: 2

Verdict:

input
100
1000
-1000000000 950042028
-946551105 -1000000000
-940508390 -1000000000
...

correct output
NO
YES
YES
YES
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 17

Group: 2

Verdict:

input
100
1000
-949977239 -1000000000
-948279892 -1000000000
-947497811 -999999999
...

correct output
YES
YES
YES
YES
YES
...

user output
1.52319678852979722983 1.52319...
Truncated

Test 18

Group: 2

Verdict:

input
100
806
-899 -1000
-898 -1000
-896 -999
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 19

Group: 2

Verdict:

input
100
777
-1000 914
-1000 915
-999 916
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 20

Group: 2

Verdict:

input
100
775
-999 998
-995 -1000
-994 -1000
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00000000000000000000 0.00000...
Truncated

Test 21

Group: 2

Verdict:

input
13
2
0 0
1 1
5
...

correct output
YES
YES
NO
YES
YES
...

user output
0.78539816339744827900 YES
0.09966865249116203807 0.09966...
Truncated

Test 22

Group: 2

Verdict:

input
1
999748
-995394098 -1000000000
-995392159 -1000000000
-995386584 -999999999
...

correct output
NO

user output
(empty)

Test 23

Group: 2

Verdict:

input
1
1000000
-954368893 -1000000000
-954366895 -1000000000
-954364896 -999999999
...

correct output
YES

user output
(empty)

Test 24

Group: 2

Verdict:

input
1
1000000
-1000000000 928772368
-1000000000 928772506
-999999999 928772642
...

correct output
YES

user output
(empty)

Test 25

Group: 2

Verdict:

input
1
999754
-901705699 -1000000000
-901702695 -1000000000
-901702062 -999999999
...

correct output
NO

user output
(empty)

Test 26

Group: 2

Verdict:

input
100
10000
-1000000000 919783772
-918885599 -1000000000
-918825263 -1000000000
...

correct output
NO
YES
YES
NO
NO
...

user output
(empty)

Test 27

Group: 2

Verdict:

input
10
99998
-997024120 -77018772
-997011201 -77017738
-996986132 -77015834
...

correct output
YES
YES
NO
YES
YES
...

user output
(empty)

Test 28

Group: 2

Verdict:

input
100
7934
-10000 9905
-10000 9906
-9999 9906
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 29

Group: 2

Verdict:

input
100
9710
-99754 -6983
-99786 -6055
-99751 -6548
...

correct output
YES
NO
NO
NO
NO
...

user output
(empty)

Test 30

Group: 2

Verdict:

input
100
2
802396401 -641287652
30956766 -527704723
2
...

correct output
YES
YES
YES
YES
YES
...

user output
4.85857369899506785771 YES
1.70377274356745478379 YES
6.05247036002025151635 YES
0.2828301

...
Truncated

Test 31

Group: 2

Verdict:

input
100
3
755025461 -953536159
-402145543 137775005
-700733185 821755784
...

correct output
YES
YES
YES
YES
YES
...

user output
5.46850471682326910727 5.87157...
Truncated

Test 32

Group: 2

Verdict:

input
100
4
-673213071 571383249
-963633735 -859013318
-591788323 791136643
...

correct output
NO
NO
NO
NO
YES
...

user output
0.22163839311385455377 3.34190...
Truncated

Test 33

Group: 2

Verdict:

input
100
5
-124483012 623794901
233757283 -234519096
-987338502 737259422
...

correct output
NO
NO
YES
NO
NO
...

user output
2.16461562990495282044 2.74619...
Truncated

Test 34

Group: 2

Verdict:

input
100
1000
154383911 872030445
-9594726 190227899
908758769 -9615631
...

correct output
NO
NO
NO
NO
NO
...

user output
0.00464018442021069209 0.01242...
Truncated

Test 35

Group: 2

Verdict:

input
100
10000
642800667 -694556052
-343795089 -341227394
800920828 676674460
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)