T1

怪毙了,数据范围是假的,考试的时候写个大力单调队列结果过了大样例,后面觉得有点假大力写了个线段树,本地过了大样例交上去MLE一半,连大样例分也没搞到,改成单调队列才A

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
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>

using namespace std;

const int maxn=1e7+20;

int n,m,cnt;
long long a[maxn];
long long ans=0;

priority_queue <long long> q;

#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;
inline void qread(long long &num)
{
int sign=1;char c;
while(!isdigit(c=gc()))if(c=='-')sign=0;num=c-'0';
while(isdigit(c=gc()))num=(num<<3)+(num<<1)+c-'0';
num=sign?num:-num;
return ;
}

inline void qread(int &num)
{
int sign=1;char c;
while(!isdigit(c=gc()))if(c=='-')sign=0;num=c-'0';
while(isdigit(c=gc()))num=(num<<3)+(num<<1)+c-'0';
num=sign?num:-num;
return ;
}

int main()
{
//ios::sync_with_stdio(false);
register int i,j;
qread(n);
qread(m);
//cin>>n>>m;
for(i=1;i<=n;i++)
{
int tmp;
qread(tmp);
for(j=1;j<=tmp;j++)
{
int t;
qread(a[++cnt]); a[cnt]-=i;
}
}
sort(a+1,a+cnt+1);
for(i=1;i<=m;i++) q.push(0);
for(i=1;i<=cnt;i++)
{
long long tmp=-q.top();
q.pop();
if(tmp<a[i]) tmp=a[i];
q.push(-(tmp+n+1));
ans=max(ans,tmp+n+1);
}
printf("%lld",ans);
return 0;
}

T2

板题,有空再打

T3

考试的时候头铁输出保证两个角相等,然后 $100\to64$

做每个定理做6遍判断 $\text{SSA}$ 即可,此时迭代出解,注意特判

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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>

using namespace std;

const double pi=3.14159265;
const double eps=1e-4;

int n,m;

inline int _exist(double x)
{
return (x-eps)>0;
}

struct tri{

double A,B,C;
double a,b,c;

inline void sinlaw()
{
double tmp=0;
if(_exist(a)&&_exist(A)) tmp=a/(sin(A/180.0*pi));
if(_exist(b)&&_exist(B)) tmp=b/(sin(B/180.0*pi));
if(_exist(c)&&_exist(C)) tmp=c/(sin(C/180.0*pi));
if(!_exist(tmp)) return ;
if(_exist(a)) A=asin(a/tmp)/pi*180.0;
if(_exist(A)) a=(sin(A/180.0*pi))*tmp;
if(_exist(b)) B=asin(b/tmp)/pi*180.0;
if(_exist(B)) b=(sin(B/180.0*pi))*tmp;
if(_exist(c)) C=asin(c/tmp)/pi*180.0;
if(_exist(C)) c=(sin(C/180.0*pi))*tmp;
if(_exist(a)&&_exist(b)&&_exist(c))
{
if(a>b&&a>c) A=max(A,180.0-B-C);
if(b>a&&b>c) B=max(B,180.0-A-C);
if(c>b&&c>a) C=max(C,180.0-A-B);
}
return ;
}

inline void clr()
{
a=-1;
b=-1;
c=-1;
A=-1;
B=-1;
C=-1;
}

inline void coslaw()
{
if(_exist(a)&&_exist(b)&&_exist(C)) c=sqrt(a*a+b*b-2.0*b*a*cos(C/180.0*pi));
if(_exist(b)&&_exist(c)&&_exist(A)) a=sqrt(c*c+b*b-2.0*b*c*cos(A/180.0*pi));
if(_exist(a)&&_exist(c)&&_exist(B)) b=sqrt(a*a+c*c-2.0*c*a*cos(B/180.0*pi));
if(_exist(a)&&_exist(b)&&_exist(c))
{
A=acos((b*b+c*c-a*a)/(2.0*b*c))/pi*180.0;
B=acos((a*a+c*c-b*b)/(2.0*a*c))/pi*180.0;
C=acos((a*a+b*b-c*c)/(2.0*a*b))/pi*180.0;
}
return ;
}

inline void tst()
{
if(_exist(A)&&_exist(B)) C=180.0-A-B;
if(_exist(A)&&_exist(C)) B=180.0-A-C;
if(_exist(B)&&_exist(C)) A=180.0-B-C;
}

}t1,t2;

double _fabs(double tmp)
{
if(tmp<0) tmp=-tmp;
return tmp;
}

int main()
{
//freopen("similarity.in","r",stdin);
//freopen("similarity.out","w",stdout);
ios::sync_with_stdio(false);
register int i,j;
int t;
cin>>t;
char tmp;
double x;
while(t--)
{
t1.clr();
t2.clr();
cin>>n>>m;
for(i=1;i<=n;i++)
{
cin>>tmp>>x;
if(tmp=='A') t1.A=x;
if(tmp=='B') t1.B=x;
if(tmp=='C') t1.C=x;
if(tmp=='a') t1.a=x;
if(tmp=='b') t1.b=x;
if(tmp=='c') t1.c=x;
}
for(i=1;i<=m;i++)
{
cin>>tmp>>x;
if(tmp=='D') t2.A=x;
if(tmp=='E') t2.B=x;
if(tmp=='F') t2.C=x;
if(tmp=='d') t2.a=x;
if(tmp=='e') t2.b=x;
if(tmp=='f') t2.c=x;
}
t1.tst();
t2.tst();
t1.sinlaw();
t2.sinlaw();
t1.coslaw();
t2.coslaw();
t1.sinlaw();
t2.sinlaw();
t1.coslaw();
t2.coslaw();
t1.sinlaw();
t2.sinlaw();
t1.coslaw();
t2.coslaw();
t1.sinlaw();
t2.sinlaw();
t1.coslaw();
t2.coslaw();
t1.sinlaw();
t2.sinlaw();
t1.coslaw();
t2.coslaw();
t1.sinlaw();
t2.sinlaw();
t1.coslaw();
t2.coslaw();
t1.tst();
t2.tst();
t1.tst();
t2.tst();
t1.tst();
t2.tst();
t1.tst();
t2.tst();
int cnt=0;
if(_fabs(t1.A-t2.A)<eps&&_exist(t1.A)&&_exist(t2.A)) cnt++;
if(_fabs(t1.B-t2.B)<eps&&_exist(t1.B)&&_exist(t2.B)) cnt++;
if(_fabs(t1.C-t2.C)<eps&&_exist(t1.C)&&_exist(t2.C))cnt++;
if(cnt==3) cout<<"YES\n";else cout<<cnt<<"\n";
}
return 0;
}