QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#93518 | #2712. A Game with Grundy | lichenghan | 0 | 51ms | 5456kb | C++23 | 867b | 2023-04-01 08:38:34 | 2023-04-01 08:38:38 |
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);
if(lb>=L) a.push_back((scl){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]);
}
}
/*
3
-7 7 3
0 2 3
-4 2 1
3 3 1
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 15
Accepted
time: 2ms
memory: 3608kb
input:
1 0 0 1 0 1 1
output:
0 1
result:
ok 2 lines
Test #2:
score: -15
Wrong Answer
time: 2ms
memory: 3672kb
input:
4 -10 10 10 0 1 1 0 1 2 0 81 40 0 79 40
output:
2 10 12 21 21
result:
wrong answer 1st lines differ - expected: '0', found: '2'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 10
Accepted
time: 51ms
memory: 5324kb
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:
156153362 156677106 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 156677969 ...
result:
ok 100001 lines
Test #9:
score: 0
Accepted
time: 40ms
memory: 5324kb
input:
100000 -886212253 159444240 9 -511825900 99 30 -703406699 14 7 120615169 58 87 -762035701 13 80 -845699984 3 2 -214132561 52 99 -139209845 98 13 -679898974 71 56 -703014962 34 38 -12968314 38 69 -607638483 33 19 -82434080 82 90 -207650736 90 73 -5379646 6 54 87217616 19 6 -719265456 94 14 -185026953...
output:
1041040701 1045646232 1045656493 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 1045656494 104...
result:
ok 100001 lines
Test #10:
score: 0
Accepted
time: 43ms
memory: 5324kb
input:
100000 -788805172 -198686050 999 -227884520 14 87 -568389832 46 88 -711109289 90 89 -734819282 18 40 -338671307 65 37 -697167152 28 77 -637908799 27 53 -343386181 29 16 -249494697 23 24 -632583832 20 16 -758847115 61 12 -512352046 18 50 -632993751 21 43 -596933966 92 16 -344963326 36 98 -777379156 7...
output:
244557128 459380367 554376306 582503320 588770011 589918206 590102942 590117936 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 590119123 ...
result:
ok 100001 lines
Test #11:
score: -10
Wrong Answer
time: 48ms
memory: 5456kb
input:
100000 754020524 959495399 999999 875733083 13 96 954878463 67 76 844730280 44 56 951113873 27 27 910461283 99 74 849139193 29 75 771994792 13 80 875376579 15 74 840138815 6 33 928792811 96 74 909433193 89 37 887613151 50 53 893636556 100 83 833127376 49 65 884023258 37 69 928441101 47 63 790556874 ...
output:
534 2111 7099 15933 17937 23548 32999 44843 52263 54001 63408 68285 72489 79253 81298 86863 96023 100331 100837 103759 106813 113988 124835 127927 132210 145639 154786 156397 158831 165915 167262 169082 170226 171583 175470 181751 181965 186061 187657 193983 194292 198446 203206 212410 214005 214986...
result:
wrong answer 1st lines differ - expected: '0', found: '534'