QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#93520 | #2712. A Game with Grundy | lichenghan | 0 | 98ms | 5404kb | C++23 | 871b | 2023-04-01 08:41:19 | 2023-04-01 08:41:22 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const double eps=1e-5;
const int N=1e5+101;
int n;
int L,R,Y;
struct scl{
int x,d;
bool operator<(scl oth){
return x<oth.x;
}
};
vector<scl> a;
int cnt[N];
int main(){
scanf("%d%d%d%d",&n,&L,&R,&Y);
for(int i=1;i<=n;i++){
int x,v,h;
scanf("%d%d%d",&x,&v,&h);
printf("%.20lf\n",1.0*Y/v*h-eps);
int rad=int(1.0*Y/v*h-eps);
int lb=x-rad,rb=x+rad;
printf("%d %d\n",lb,rb);
a.push_back((scl){max(L,lb),1});
if(rb<R)a.push_back((scl){rb+1,-1});
}
sort(a.begin(),a.end());
int cur=0;
int lst=L;
for(auto p:a){
cnt[cur]+=p.x-lst;
cur+=p.d;
lst=p.x;
}
cnt[cur]+=R+1-lst;
for(int i=0;i<=n;i++){
if(i) cnt[i]+=cnt[i-1];
printf("%d\n",cnt[i]);
}
}
/*
4
-10 10 10
0 1 1
0 1 2
0 81 40
0 79 40
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3612kb
input:
1 0 0 1 0 1 1
output:
0.99999000000000004551 0 0 0 1
result:
wrong answer 1st lines differ - expected: '0', found: '0.99999000000000004551'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 98ms
memory: 5404kb
input:
100000 623345700 780023668 1 679260488 18 79 688764487 70 90 738664335 48 57 661502800 75 34 683973183 47 10 700648994 15 15 763130119 38 37 726159655 4 94 644241536 12 80 702490671 10 23 639480105 66 65 687387964 57 40 759214821 79 44 764375882 7 75 744874564 5 52 776042015 23 54 687549107 80 8 744...
output:
4.38887888888888877403 679260484 679260492 1.28570428571428552189 688764486 688764488 1.18748999999999993449 738664334 738664336 0.45332333333333335590 661502800 661502800 0.21275595744680850241 683973183 683973183 0.99999000000000004551 700648994 700648994 0.97367421052631575318 763130119 763130119...
result:
wrong answer 1st lines differ - expected: '156153362', found: '4.38887888888888877403'