제출 #253203

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2532032020-07-27 12:02:25nandonathanielWish (LMIO19_noras)C++14
100 / 100
296 ms4736 KiB
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n;
vector<pii> segment;
double r,A,B,C,D,vA,vB;
cin >> n >> r;
for(int i=1;i<=n;i++){
cin >> A >> B >> C >> D;
vA=C-A;vB=D-B;
if(A!=C){
double m=(D-B)/(C-A);
double c=B-m*A;
double disk=m*m*c*c-(m*m+1.0)*(c*c-r*r);
if(disk<0.0)continue;
disk=sqrt(disk);
double x1=(-1.0*m*c+disk)/(m*m+1.0),x2=(-1.0*m*c-disk)/(m*m+1.0);
double time1=(x1-A)/vA+1.0,time2=(x2-A)/vA+1.0;
if(time2<time1)swap(time1,time2);
if(time2<1.0)continue;
if(time1<1.0)time1=1.0;
int masuk=(int)ceil(time1),keluar=(int)floor(time2)+1;
if(keluar>masuk){
segment.push_back({masuk,i});
segment.push_back({keluar,-i});
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...