QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#424398#2712. A Game with Grundychengliuyy0 51ms9548kbC++141.6kb2024-05-29 09:20:452024-05-29 09:20:47

Judging History

你现在查看的是最新测评结果

  • [2024-05-29 09:20:47]
  • 评测
  • 测评结果:0
  • 用时:51ms
  • 内存:9548kb
  • [2024-05-29 09:20:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
#define f first
#define s second
#define ll long long
#define pb push_back
#define pi pair <ll,ll>
#define vi vector <ll>
#define size(x) (ll)(x).size()
#define all(x) x.begin(), x.end()
void setIO(string name = "") {
	cin.tie(0)->sync_with_stdio(0);
	if (size(name)) {
		freopen((name + ".in").c_str(), "r", stdin);
		freopen((name + ".out").c_str(), "w", stdout);
	}
}

ll N, L, R, Y;
vector <pi> ranges;

int main()
{
	setIO();
	
	cin >> N >> L >> R >> Y;
	for (int i = 0; i < N; i++) {
		double x, v, h;
		cin >> x >> v >> h;
		double l = x - (double) h / v * Y;
		double r = x + (double) h / v * Y;
		//if l = 1 , r =5,push {2,5}, inlude 2 3 4 which is 5-2
		//if l = 1 , r =5.2,push {2,6}, inlude 2 3 4  5 which is 6-2
		ranges.pb({floor(l) + 1, 1});//include
		ranges.pb({ceil(r), -1});//no include
	}
	
	vi ans(N + 1, 0);
	ranges.pb({L, 0});
	ranges.pb({R + 1, 0});
	sort(ranges.begin(), ranges.end());
	ll cur = 0;
	
	for (int i = 0; i < size(ranges); i++) {
		if (i > 0)
 		{
			pi u = ranges[i];
			pi v = ranges[i - 1];
			//if u.f is 5, v.f is 2, should have point 2 3 4
			// if R is 3? should be 2,3 === R+1-2
			// if L is 3, should be 3 4 === 5 - max(3,2) = 2
			if (i > 0 && u.f >= L && v.f <= R) ans[cur] += (min(R + 1, u.f) - max(L, v.f));
		}
		cur += ranges[i].s;
	}
	
	for (int i = 1; i <= N; i++)
		ans[i] += ans[i - 1];
	for (int i = 0; i <= N; i++) 
		cout << ans[i] << '\n';
	return 0;                    
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 15
Accepted
time: 0ms
memory: 3980kb

input:

1
0 0 1
0 1 1

output:

0
1

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3688kb

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: 47ms
memory: 8772kb

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: 50ms
memory: 8356kb

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: 45ms
memory: 8676kb

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: 45ms
memory: 7736kb

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: -15
Wrong Answer
time: 34ms
memory: 9548kb

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:

wrong answer 1011th lines differ - expected: '1176993', found: '1176991'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 10
Accepted
time: 46ms
memory: 7324kb

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: 44ms
memory: 8696kb

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: 51ms
memory: 8304kb

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: 8560kb

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: -10
Wrong Answer
time: 34ms
memory: 8000kb

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:

wrong answer 1011th lines differ - expected: '1991769593', found: '1991769591'