QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#771313#8672. 排队user100860 11ms7832kbC++23725b2024-11-22 11:34:202024-11-22 11:34:28

Judging History

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

  • [2024-11-22 11:34:28]
  • 评测
  • 测评结果:0
  • 用时:11ms
  • 内存:7832kb
  • [2024-11-22 11:34:20]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 10;

int l[N], r[N], a[N];

struct Q
{
	int l, r, ans, id;
}qry[N];

signed main()
{
	int n, q; cin >> n >> q;
	for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];
	for (int i = 1; i <= q; i++) cin >> qry[i].l >> qry[i].r;
	sort(qry + 1, qry + 1 + q, [](Q q1, Q q2) { return q1.r < q2.r; });
	for (int i = 1, id = 1; i <= n; i++)
	{
		for (int j = 1; j <= i; j++)
			if (l[i] <= a[j] && a[j] <= r[i]) a[j]++;
		while (id <= q && qry[id].r == i)
		{
			qry[id].ans = a[qry[id].l];
			id++;
		}
	}
	sort(qry + 1, qry + 1 + q, [](Q q1, Q q2) { return q1.id < q2.id; });
	for (int i = 1; i <= q; i++) cout << qry[i].ans << '\n';
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 1ms
memory: 7736kb

input:

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

output:

1
3
1

result:

ok 3 number(s): "1 3 1"

Test #2:

score: 0
Wrong Answer
time: 11ms
memory: 7832kb

input:

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

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

wrong answer 104th numbers differ - expected: '10', found: '11'

Subtask #2:

score: 0
Time Limit Exceeded

Test #12:

score: 0
Time Limit Exceeded

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:


result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #22:

score: 0
Time Limit Exceeded

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:


result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #32:

score: 0
Time Limit Exceeded

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:


result:


Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%