QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#93519 | #2712. A Game with Grundy | le6666 | 25 ✓ | 50ms | 7704kb | C++14 | 1.1kb | 2023-04-01 08:41:13 | 2023-04-01 08:41:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+5;
int n;
ll l, r, y;
struct node{
ll pos;
int v;
};
node a[MAXN*2];
ll cnt[MAXN];
void read(){
scanf("%d%lld%lld%lld", &n, &l, &r, &y);
for(int i = 1; i <= n; i++){
ll x, v, h;
scanf("%lld%lld%lld", &x, &v, &h);
ll t = (y * h - 1) / v;
a[i*2-1] = {max(x-t,l), 1};
a[i*2] = {min(x+t+1,r+1), -1};
}
}
void solve(){
sort(a+1, a+1+n+n, [](node x, node y){
if(x.pos != y.pos)
return x.pos < y.pos;
return x.v > y.v;
});
int num = 0;
a[0] = {l, 0}, a[n*2+1] = {r+1, 0};
for(int i = 0; i <= n*2; i++){
num += a[i].v;
cnt[num] += a[i+1].pos - a[i].pos;
// printf("print:\n");
// ll sum = 0;
// for(int i = 0; i <= n; i++){
// sum += cnt[i];
// printf("%lld\n", sum);
// }
}
}
void print(){
ll sum = 0;
for(int i = 0; i <= n; i++){
sum += cnt[i];
printf("%lld\n", sum);
}
}
int main(){
read();
solve();
print();
// for(int i = 0; i <= n*2+1; i++){
// printf("%lld %d\n", a[i].pos, a[i].v);
// }
return 0;
}
詳細信息
Subtask #1:
score: 15
Accepted
Test #1:
score: 15
Accepted
time: 2ms
memory: 3808kb
input:
1 0 0 1 0 1 1
output:
0 1
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
4 -10 10 10 0 1 1 0 1 2 0 81 40 0 79 40
output:
0 2 10 12 21
result:
ok 5 lines
Test #3:
score: 0
Accepted
time: 49ms
memory: 7200kb
input:
100000 -111153 15028 1 -93341 83 83 -58854 58 54 -15386 100 8 -58458 12 85 -82699 66 8 -47110 28 4 -97813 26 93 -65676 34 11 -37558 7 67 -55306 75 49 8961 5 12 -103329 23 10 -33148 12 37 -51388 73 68 -19086 51 90 4838 60 43 -103480 37 56 -86713 88 93 -93443 99 9 -53467 47 3 -6103 95 21 -102656 2 29 ...
output:
2004 10176 27052 50630 75419 95934 110103 118491 122789 124808 125646 125992 126121 126162 126174 126179 126181 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182 126182...
result:
ok 100001 lines
Test #4:
score: 0
Accepted
time: 37ms
memory: 6716kb
input:
100000 -911094 -298958 9 -718697 40 75 -713541 34 85 -424023 81 91 -391135 91 16 -870225 4 51 -826149 1 91 -886764 84 50 -863656 68 1 -857000 83 90 -765951 31 74 -662194 72 96 -637526 15 90 -352478 12 55 -819674 8 30 -811206 5 6 -864885 42 32 -678486 90 70 -365909 74 24 -369429 6 79 -411736 37 3 -49...
output:
295 2191 9707 29448 67843 129016 208610 298313 385012 458976 515950 555459 581174 596416 604531 608725 610767 611661 611936 612098 612131 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 612137 6...
result:
ok 100001 lines
Test #5:
score: 0
Accepted
time: 38ms
memory: 6804kb
input:
100000 337290 889177 999 520941 8 11 374385 37 39 441909 51 32 461925 29 19 482815 70 49 692045 20 13 666551 48 37 517637 87 80 667980 51 63 369413 95 49 512972 58 84 539737 36 71 724177 88 82 522351 35 11 838283 98 46 691297 29 72 736862 16 95 493205 74 11 669294 31 44 629986 59 51 360057 78 51 843...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 100001 lines
Test #6:
score: 0
Accepted
time: 22ms
memory: 7700kb
input:
100000 352958 558529 999999 482910 69 13 531802 46 65 550129 45 54 390986 81 52 409795 8 95 423018 16 19 365815 65 64 482423 17 54 367821 37 13 426872 77 36 553922 33 12 437969 76 36 405994 72 12 432205 95 60 523756 81 41 522990 61 87 409688 79 19 379847 95 30 500488 68 89 529158 94 90 431888 46 60 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 100001 lines
Test #7:
score: 0
Accepted
time: 37ms
memory: 7456kb
input:
100000 -1000000 1000000 12345 0 1 100 0 1 99 0 1 98 0 1 97 0 1 96 0 1 95 0 1 94 0 1 93 0 1 92 0 1 91 0 1 90 0 1 89 0 1 88 0 1 87 0 1 86 0 1 85 0 1 84 0 1 83 0 1 82 0 1 81 0 1 80 0 1 79 0 1 78 0 1 77 0 1 76 0 1 75 0 1 74 0 1 73 0 1 72 0 1 71 0 1 70 0 1 69 0 1 68 0 1 67 0 1 66 0 1 65 0 1 64 0 1 63 0 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 100001 lines
Subtask #2:
score: 10
Accepted
Test #8:
score: 10
Accepted
time: 50ms
memory: 6740kb
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: 50ms
memory: 6920kb
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: 42ms
memory: 7348kb
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: 0
Accepted
time: 43ms
memory: 7660kb
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:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 100001 lines
Test #12:
score: 0
Accepted
time: 26ms
memory: 7704kb
input:
100000 -1000000000 1000000000 123456 0 1 100 0 1 99 0 1 98 0 1 97 0 1 96 0 1 95 0 1 94 0 1 93 0 1 92 0 1 91 0 1 90 0 1 89 0 1 88 0 1 87 0 1 86 0 1 85 0 1 84 0 1 83 0 1 82 0 1 81 0 1 80 0 1 79 0 1 78 0 1 77 0 1 76 0 1 75 0 1 74 0 1 73 0 1 72 0 1 71 0 1 70 0 1 69 0 1 68 0 1 67 0 1 66 0 1 65 0 1 64 0 1...
output:
1975308793 1975308795 1975308797 1975308799 1975308801 1975308803 1975308805 1975308807 1975308809 1975308811 1975555705 1975555707 1975555709 1975555711 1975555713 1975555715 1975555717 1975555719 1975555721 1975555723 1975802617 1975802619 1975802621 1975802623 1975802625 1975802627 1975802629 197...
result:
ok 100001 lines
Extra Test:
score: 0
Extra Test Passed