답안 #697744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
697744 2023-02-11T02:47:06 Z winthemcut3 A Game with Grundy (CCO20_day1problem1) C++14
0 / 25
0 ms 212 KB
#include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define PB push_back
#define ALL(v) (v).begin(), (v).end()
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--)
#define fi   first
#define se   second
#define BIT(x, i) (((x) >> (i)) & 1)
#define f(x) f[int((x)+mxM+2)]
using namespace std;

/** END OF TEMPLATE **/

const int mxM = 1e6 + 2;
const int mxN = 1e5 + 5;
ll n, L, R, Y;
int f[mxM*2 + 10];
ll num[mxN];
vector< pair<int, int> > s;
void update(ll x, ll v, ll h) {
    ll b = -(x*v);
    long double X = -(Y+b)*h;
    X = floor(1.0*X/v); X++;
    ll rX = x + (x - X) + 1;
    if(X < L) X = L;
    if(rX > R) rX = R;
    s.PB({X, 1}); s.PB({rX, -1});
}

int main()
{
    FastIO;
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
    cin >> n >> L >> R >> Y;
    FOR(i, 1, n) {
        ll x, v, h; cin >> x >> v >> h;
        update(x, v, h);
    }
    s.PB({R+1, 0});
    sort(ALL(s));

    int x = L, sum = 0;
    for (auto [i, c] : s) {
        num[sum] += i - x;
        x = i;
        sum += c;
    }
    FOR(i, 1, n) num[i] += num[i-1];
    FOR(i, 0, n) cout << num[i] << '\n';

    return 0;
}

/*
-5 2
-4 5
3 4
*/

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:46:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   46 |     for (auto [i, c] : s) {
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -