QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#424391#2712. A Game with Grundychengliuyy0 54ms7604kbC++141.5kb2024-05-29 09:10:592024-05-29 09:11:01

Judging History

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

  • [2024-05-29 09:11:01]
  • 评测
  • 测评结果:0
  • 用时:54ms
  • 内存:7604kb
  • [2024-05-29 09:10:59]
  • 提交

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 = 1; i < size(ranges); i++) {
 		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 += u.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;                    
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 15
Accepted
time: 1ms
memory: 3972kb

input:

1
0 0 1
0 1 1

output:

0
1

result:

ok 2 lines

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3772kb

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: 36ms
memory: 7604kb

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: 10
Accepted
time: 54ms
memory: 7516kb

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: 10
Accepted
time: 54ms
memory: 7408kb

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
Wrong Answer
time: 49ms
memory: 7596kb

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:

wrong answer 1234th lines differ - expected: '0', found: '107'