QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#560151#8672. 排队Sakuyamaid0 92ms30952kbC++207.0kb2024-09-12 13:36:432024-09-12 13:36:45

Judging History

你现在查看的是最新测评结果

  • [2024-09-12 13:36:45]
  • 评测
  • 测评结果:0
  • 用时:92ms
  • 内存:30952kb
  • [2024-09-12 13:36:43]
  • 提交

answer

// buxiangwanla
// 你紫名觉得是我的锅,那就是我的锅,为什么你知道吗?因为紫名说的话,就像是一个癌症晚期患者说的话一样。
// 他都已经这样了,你为什么不顺从他呢?你总要给人最后一段时间一个好的回忆吧,最后的时光里。
// 因为紫名这个段位很尴尬,紫名橙名再往上一点,grandmaster,可能说,欸,有点实力,能操作一下。
// 紫名往下,绿名,蓝名,啊,人家是纯属玩游戏的,因为太垃圾了,自己也知道自己没什么实力。
// 但紫名,上不去下不来的这个段位,他觉得,蓝名的人不配跟他一起玩儿,对吧?蓝名是最垃圾的。
// 但是呢他想上去,他又上不去,所以这个分段是最尴尬的,没办法,卡在这里了。
// 想操作,又操作不起来,掉下去吧,他又觉得不值得,对吧,我好不容易从蓝名打到紫名了,我为什么还要掉下去呢?
// 这个人说优越狗越说越起劲,为什么他会这么说?因为他是紫名。
// 他觉得你比我段位高,你说的任何话都是优越,我并不管你说的有没有道理。
// 我紫名,我最猛,我WF2017我上我能夺冠,那打比赛全是sb。你比我段位高你说话就是放屁,这就是这种人的想法。但是呢,他的想法是对的,为什么呢?
// 因为他癌症晚期。没办法,我同意,对不起,我优越了。可能是我膨胀了,不好意思啊,我膨胀了。我紫名是没操作,难道我就看不懂谁背锅吗?
// 不是,如果你看得懂的话,就不会在这里抬杠了,对吧。

// If you Blue Name think it's my fault, it's my fault. Do you know why? Because what Blue Name says is like something a terminal cancer patient would say.
// He's already like that. Why don't you just go along with it? You always have to give someone a good memory for the last period of time, right? In the last time.
// Because the blue name of this rating is very awkward, blue name purple name a little further up, master, may say, hey, a little strength, can operate a little.
// Blue name down, green name, ah, people are purely playing the game, because it is too trash, they also know that they do not have much strength.
// But the blue name, can't go up or down in this rating, he thinks, the green name of the person does not deserve to play with him, right? Green name is the most trash.
// But he wants to go up, he can not go up, so this rating is the most embarrassing, no way, stuck here.
// I want to solve, but I can not solve the problems, fall down, he also think it is not worth it, right, it is not easy for me to fight from the green name to the blue name, why do I have to fall down?
// This person said superior dog the more he said the more energized, why would he say so? Because he's blue.
// He thinks you are higher than me, anything you say is superior, I don't care if what you say makes sense or not.
// I'm not sure if there's any truth in what you're saying, but I'm not sure if there's any truth in what you're saying, and I'm not sure if there's any truth in what you're saying, and I'm not sure if there's any truth in what you're saying. But then, his idea is right, why?
// Because he has terminal cancer. No way, I agree. I'm sorry, I'm superior. Maybe I'm bloated. I'm sorry, I'm bloated. My blue name is no operation. Can't I see who's taking the fall?
// No, if you could see it, you wouldn't be here carrying the can, would you.
// 
#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ULL;
using LL = long long;

constexpr int N = 1e6 + 5, mod = 998244353;
constexpr double eps = 1e-8;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")

#define fi first
#define se second
#define int long long
#define lowbit(x) (x & (-x))
#define PII pair<int, int>
#define mid ((l + r) >> 1)

int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }

int ksm(int a, int b){
    a %= mod;
    int res = 1;
    while(b){
        if(b & 1)res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

int n, m;
int a[N];
int l[N], r[N], q;
int ans[N];
struct Node{
   int l, id;
};
vector<Node>Q[N];
int tag[N << 2], maxn[N << 2], minn[N << 2];

void pushdown(int u, int l, int r){
    if(tag[u]){
        int c = tag[u];
        tag[u << 1] += c;
        tag[u << 1 | 1] += c;
        maxn[u << 1] += c;
        maxn[u << 1 | 1] += c;
        minn[u << 1] += c;
        minn[u << 1 | 1] += c;
        tag[u] = 0;
    }
}

int pushupmax(int res1, int res2){
    return max(res1, res2);
}

int pushupmin(int res1, int res2){
    return min(res1, res2);
}

void update(int u, int l, int r, int x, int y, int z){
    if(x <= l && y >= r){
        tag[u] += z;
        maxn[u] += z;
        minn[u] += z;
        return;
    }
    pushdown(u, l, r);
    if(x <= mid)update(u << 1, l, mid, x, y, z);
    if(y > mid)update(u << 1 | 1, mid + 1, r, x, y, z);
    maxn[u] = pushupmax(maxn[u << 1], maxn[u << 1 | 1]);
    minn[u] = pushupmin(minn[u << 1], minn[u << 1 | 1]);
}

int queryl(int u, int l, int r, int x, int y, int p){
    if(x <= l && y >= r){
        if(minn[u] > p)return -1;
        if(l == r)return l;
    }
    pushdown(u, l, r);
    if(x <= mid){
        int res = queryl(u << 1, l, mid, x, y, p);
        if(res != -1)return res;
    }
    if(x <= mid){
        return queryl(u << 1 | 1, mid + 1, r, x, y, p);
    }
    return -1;
}

int queryr(int u, int l, int r, int x, int y, int p){
    if(x <= l && y >= r){
        if(maxn[u] < p)return -1;
        if(l == r)return l;
    }
    pushdown(u, l, r);
    if(y > mid){
        int res = queryr(u << 1 | 1, mid + 1, r, x, y, p);
        if(res != -1)return res;
    }
    if(x <= mid){
        return queryr(u << 1, l, mid, x, y, p);
    }
    return -1;
}

int query(int u, int l, int r, int p){
    if(l == r){
        return maxn[u];
    }
    pushdown(u, l, r);
    if(p <= mid)return query(u << 1, l, mid, p);
    else return query(u << 1 | 1, mid + 1, r, p);
}

void Sakuya()
{
    cin >> n >> q;
    for(int i = 1; i <= n; ++ i)cin >> l[i] >> r[i];
    
    for(int i = 1; i <= q; ++ i){
        int L, R;
        Q[R].emplace_back(L, i);
    }

    for(int i = 1; i <= n; ++ i){
        auto L = l[i], R = r[i];
        auto ll = queryl(1, 1, n, 1, i, R);
        auto rr = queryr(1, 1, n, 1, i, L);
        if(ll != -1 && rr != -1){
            update(1, 1, n, ll, rr, 1);
        }
        if(Q[i].size()){
            for(auto [LL, id] : Q[i]){
                ans[id] = query(1, 1, n, LL);
            }
        }
    }
    for(int i = 1; i <= q; ++ i){
        cout << ans[i] << "\n";
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    // int T;
    // for (cin >> T; T -- ; )
        Sakuya();

}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 7668kb

input:

3 3
0 0
1 2
0 2
1 1
1 3
2 3

output:

0
0
0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 91ms
memory: 26020kb

input:

200000 200000
3 6
3 3
6 10
1 7
2 7
6 9
4 6
3 4
0 8
0 6
3 5
3 4
1 8
7 8
4 5
0 3
1 5
2 9
1 2
1 2
3 4
5 7
6 10
3 9
4 7
1 6
2 6
1 7
2 5
1 7
6 8
1 1
0 7
7 8
0 9
1 7
3 8
3 7
1 2
4 8
5 6
0 6
5 6
2 7
2 6
0 6
0 6
1 7
2 5
0 3
0 3
7 10
3 8
0 2
3 4
3 7
4 9
0 6
4 7
2 6
8 10
2 10
4 10
3 3
2 6
4 5
3 9
1 8
1 2
2 9
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st numbers differ - expected: '11', found: '0'

Subtask #3:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 84ms
memory: 30952kb

input:

200000 200000
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 0
0 9
0 10
0 0
0 0
0 13
0 14
0 0
0 16
0 17
0 18
0 19
0 0
0 21
0 22
0 23
0 0
0 0
0 0
0 0
0 28
0 0
0 30
0 31
0 32
0 33
0 34
0 35
0 0
0 0
0 38
0 39
0 40
0 41
0 42
0 43
0 44
0 45
0 46
0 0
0 48
0 49
0 50
0 51
0 52
0 53
0 54
0 55
0 56
0 57
0 0
0 59
0 60
0 0
0 0
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st numbers differ - expected: '19141', found: '0'

Subtask #4:

score: 0
Wrong Answer

Test #32:

score: 0
Wrong Answer
time: 92ms
memory: 28572kb

input:

200000 200000
0 200000
1 200000
1 200000
0 200000
0 200000
1 200000
1 200000
1 200000
0 200000
1 200000
0 200000
0 200000
1 200000
0 200000
0 200000
0 200000
0 200000
1 200000
0 200000
0 200000
1 200000
0 200000
1 200000
1 200000
1 200000
1 200000
0 200000
0 200000
1 200000
2 200000
1 200000
2 20000...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st numbers differ - expected: '71224', found: '0'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%