QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#384428 | #4005. Frog | wdw | WA | 31ms | 4088kb | C++20 | 2.9kb | 2024-04-09 23:24:38 | 2024-04-09 23:24:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
//#define int long long
const int N=2e5+5;
#define endl '\n'
const double pi=acos(-1);
const double eps=1e-10;
double l(double x1,double y1,double x2,double y2){
return sqrt(1.0*(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
void solve(){
double a,b;
cin>>a>>b;
double x1=cos(1.0*pi*a/180),y1=sin(1.0*pi*a/180),x2=cos(1.0*pi*b/180),y2=sin(1.0*pi*b/180);
double len=sqrt(1.0*(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/2;
double h=sqrt(1.0-len*len);
double z1=(x1+x2)/2,z2=(y1+y2)/2;
double yy1=z1*2,yy2=z2*2;
vector<pair<double,double>>px;
px.push_back({x1,y1});
if(a==b){
cout<<0<<endl;
cout<<x1<<" "<<y1<<endl;
return;
}
//cout<<z1<<" "<<z2<<endl;
if(z1<eps&&z2<eps) {
if (abs(x1 - x2) < eps) {
if (y1 < y2) {
px.push_back({x1 - 1, y1});
px.push_back({x1 - 1, y1 + 1});
px.push_back({x1 - 1, y1 + 2});
px.push_back({x2, y2});
} else {
px.push_back({x1 - 1, y1});
px.push_back({x1 - 1, y1 - 1});
px.push_back({x1 - 1, y1 - 2});
px.push_back({x2, y2});
}
} else if (abs(y1 - y2) < eps) {
if (x1 < x2) {
px.push_back({x1, y1 + 1});
px.push_back({x1 + 1, y1 + 1});
px.push_back({x1 + 2, y1 + 1});
px.push_back({x2, y2});
} else {
px.push_back({x1, y1 + 1});
px.push_back({x1 - 1, y1 + 1});
px.push_back({x1 - 2, y1 + 1});
px.push_back({x2, y2});
}
} else {
double xxx = cos((1.0 * pi * a + 1.0 * pi * b) / 2 / 180), yyy = sin(
(1.0 * pi * a + 1.0 * pi * b) / 2 / 180);
px.push_back({x1 + xxx, y1 + yyy});
px.push_back({xxx, yyy});
px.push_back({x2 + xxx, y2 + yyy});
px.push_back({x2, y2});
}
}else{
// cout<<abs(l(0,0,yy1,yy2))<<endl;
if(abs(a-b)>90){
double xxx = cos((1.0 * pi * a + 1.0 * pi * b) / 2 / 180), yyy = sin(
(1.0 * pi * a + 1.0 * pi * b) / 2 / 180);
px.push_back({x1 + xxx, y1 + yyy});
px.push_back({xxx+yy1, yyy+yy2});
px.push_back({x2 + xxx, y2 + yyy});
px.push_back({x2, y2});
}else{
px.push_back({yy1,yy2});
px.push_back({x2,y2});
}
}
cout<<px.size()-1<<endl;
for(auto y:px){
cout<<y.first<<" "<<y.second<<endl;
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
cout<<fixed<<setprecision(12);
int T=1;
cin>>T;
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4068kb
input:
3 0 0 0 90 180 0
output:
0 1.000000000000 0.000000000000 2 1.000000000000 0.000000000000 1.000000000000 1.000000000000 0.000000000000 1.000000000000 4 -1.000000000000 0.000000000000 -1.000000000000 1.000000000000 0.000000000000 1.000000000000 1.000000000000 1.000000000000 1.000000000000 0.000000000000
result:
ok ok
Test #2:
score: -100
Wrong Answer
time: 31ms
memory: 4088kb
input:
10000 194 96 89 164 139 41 323 35 185 221 0 275 53 116 233 79 209 91 236 12 94 291 332 293 207 31 133 329 60 114 1 91 273 103 69 193 220 303 100 118 42 15 331 201 26 103 347 292 184 148 307 197 84 326 52 224 257 27 3 99 310 26 138 288 112 17 206 159 302 104 58 121 276 268 236 134 281 173 147 128 72 ...
output:
4 -0.970295726276 -0.241921895600 -1.789447770565 0.331654540751 -1.893976233833 1.326176436120 -0.923680507557 1.568098331719 -0.104528463268 0.994521895368 2 0.017452406437 0.999847695156 -0.943809289501 1.275485050973 -0.961261695938 0.275637355817 4 -0.754709580223 0.656059028991 -0.754709580223...
result:
wrong answer participant answer more than standard answer. (Test case 1)