답안 #268284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
268284 2020-08-16T10:59:47 Z imeimi2000 A Game with Grundy (CCO20_day1problem1) C++17
25 / 25
76 ms 5224 KB
#include <bits/stdc++.h>

using namespace std;

int n, L, R, Y;
int ans[100001];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> L >> R >> Y;
    vector<pair<int, int>> P;
    for (int i = 1; i <= n; ++i) {
        int x, v, h;
        cin >> x >> v >> h;
        int l = max(L, x - (Y * h - 1) / v);
        int r = min(R, x + (Y * h - 1) / v);
        P.emplace_back(l, 1);
        P.emplace_back(r + 1, -1);
    }
    P.emplace_back(R + 1, 0);
    sort(P.begin(), P.end());
    int x = L, sum = 0;
    for (auto [i, c] : P) {
        ans[sum] += i - x;
        x = i;
        sum += c;
    }
    for (int i = 1; i <= n; ++i) ans[i] += ans[i - 1];
    for (int i = 0; i <= n; ++i) printf("%d\n", ans[i]);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 56 ms 4332 KB Output is correct
4 Correct 69 ms 4452 KB Output is correct
5 Correct 57 ms 4456 KB Output is correct
6 Correct 42 ms 3940 KB Output is correct
7 Correct 51 ms 3944 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 56 ms 4332 KB Output is correct
4 Correct 69 ms 4452 KB Output is correct
5 Correct 57 ms 4456 KB Output is correct
6 Correct 42 ms 3940 KB Output is correct
7 Correct 51 ms 3944 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 59 ms 4940 KB Output is correct
10 Correct 76 ms 5224 KB Output is correct
11 Correct 63 ms 5148 KB Output is correct
12 Correct 67 ms 4968 KB Output is correct
13 Correct 57 ms 4332 KB Output is correct