1 条题解

  • 0
    @ 2025-5-14 9:19:09
    #include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    
    ll n, m, l, r, s, e, d, a[10000000], maxx, sumans, sum1, sum2;
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin >> n >> m;
        for (int i = 1; i <= m; i++)
        {
            cin >> l >> r >> s >> e;
            d = (e - s) / (r - l);
            a[l] += s;
            a[l + 1] += d - s;
            a[r + 1] -= d + e;
            a[r + 2] += e;
        }
        sumans = 0;
        maxx = 0;
        sum1 = 0;
        sum2 = 0;
        for (int i = 1; i <= n; i++)
        {
            sum1 += a[i];
            sum2 += sum1;
            maxx = max(maxx, sum2);
            sumans ^= sum2;
        }
        cout<<sumans<<" "<<maxx<<endl;
    
        return 0;
    }
    
    
    • 1

    信息

    ID
    4955
    时间
    500ms
    内存
    250MiB
    难度
    4
    标签
    递交数
    2
    已通过
    2
    上传者