QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#424440 | #2712. A Game with Grundy | chengliuyy | 0 | 49ms | 7692kb | C++14 | 1.7kb | 2024-05-29 10:18:38 | 2024-05-29 10:18:38 |
Judging History
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) (int)(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;
ll l = x - (double) h / v * Y;
ll r = ceil(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({l + 1, 1});//include
ranges.pb({r, -1});//no include
/* int x, v, h;
cin >> x >> v >> h;
double l = x - (double) h / v * Y;
double r = x + (double) h / v * Y;
ranges.pb({floor(l) + 1, 1});
ranges.pb({ceil(r), -1}); */
}
vi ans(N + 1, 0);
ranges.pb({L, 0});
ranges.pb({R + 1, 0});
sort(ranges.begin(), ranges.end());
int 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;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 15
Accepted
time: 1ms
memory: 3980kb
input:
1 0 0 1 0 1 1
output:
0 1
result:
ok 2 lines
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
input:
4 -10 10 10 0 1 1 0 1 2 0 81 40 0 79 40
output:
0 2 11 13 21
result:
wrong answer 3rd lines differ - expected: '10', found: '11'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 10
Accepted
time: 48ms
memory: 7692kb
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
Wrong Answer
time: 49ms
memory: 7560kb
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:
1041117044 1045646549 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:
wrong answer 1st lines differ - expected: '1041040701', found: '1041117044'