Submission #362718

# Submission time Handle Problem Language Result Execution time Memory
362718 2021-02-04T08:01:40 Z alextodoran A Game with Grundy (CCO20_day1problem1) C++17
15 / 25
160 ms 12652 KB
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N_MAX = 100002;

const double EPS = 1e-8;

int n;

int L, R, Y;

double getx (int v, int h, int x)
{
    return x + 1.0 * Y * h / v;
}

map <int, int> mp;

int ans[N_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    cin >> L >> R >> Y;
    for(int i = 1; i <= n; i++)
    {
        int v, h, x;
        cin >> x >> v >> h;
        int l = ceil(getx(-v, h, x) + EPS);
        int r = floor(getx(v, h, x) - EPS);
        l = max(L, l);
        r = min(R, r);
        mp[l]++;
        mp[r + 1]--;
    }
    mp[R + 1];
    int last = L;
    int cnt = 0;
    for(pair <int, int> p : mp)
    {
        ans[cnt] += p.first - last;
        cnt += p.second;
        last = p.first;
    }
    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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 123 ms 7532 KB Output is correct
4 Correct 146 ms 10860 KB Output is correct
5 Correct 160 ms 10732 KB Output is correct
6 Correct 39 ms 2668 KB Output is correct
7 Correct 56 ms 5740 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 123 ms 7532 KB Output is correct
4 Correct 146 ms 10860 KB Output is correct
5 Correct 160 ms 10732 KB Output is correct
6 Correct 39 ms 2668 KB Output is correct
7 Correct 56 ms 5740 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Incorrect 143 ms 12652 KB Output isn't correct
10 Halted 0 ms 0 KB -