QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#410616#6664. 학생들Unknown15080 59ms11476kbC++201.2kb2024-05-14 10:28:482024-05-14 10:28:49

Judging History

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

  • [2024-05-14 10:28:49]
  • 评测
  • 测评结果:0
  • 用时:59ms
  • 内存:11476kb
  • [2024-05-14 10:28:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ii = pair<int, int>;

pair<int, vector<int>> complaint(int N, vector<int> L, vector<int> R){
	int M = L.size();
	vector<ii> segments(M);
	for (int i = 0; i < M; i++) segments[i] = {L[i], R[i]};

	vector<int> pfx(N), sfx(N);

	sort(segments.begin(), segments.end(), [&](ii p1, ii p2){
		return p1.second < p2.second;
	});

	for (int i = 0, it = 0; i < N; i++){
		int lst = -1, cnt = 0;
		while (it < M && segments[it].second == i){
			if (lst < segments[it].first){
				lst = segments[it].second;
				cnt++;
			}
			it++;
		}
		pfx[i] = cnt;
	}

	sort(segments.begin(), segments.end(), [&](ii p1, ii p2){
		return p1.first > p2.first;
	});

	for (int i = N - 1, it = 0; i >= 0; i--){
		int lst = N, cnt = 0;
		while (it < M && segments[it].first == i){
			if (lst > segments[it].second){
				lst = segments[it].first;
				cnt++;
			}
			it++;
		}
		sfx[i] = cnt;
	}

	int k = pfx[N - 1];
	vector<int> res;

	for (int i = 0; i < N; i++){
		int lhs = (i == 0) ? 0 : pfx[i - 1];
		int rhs = (i == N-1) ? 0 : sfx[i + 1];
		if (lhs + rhs + 1 == k) res.push_back(i);
	}

	return {k, res};
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3964kb

input:

10 10
4 4
7 7
1 1
6 6
7 7
2 2
4 4
4 4
7 7
6 6

output:

0


result:

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

Subtask #2:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 1ms
memory: 3808kb

input:

2500 2500
436 436
48 48
971 971
2223 2223
2046 2046
1706 1706
1847 1847
1739 1739
2398 2398
525 525
2479 2479
490 490
1434 1434
2160 2160
2049 2049
771 771
1758 1758
1651 1651
1496 1496
538 538
586 586
2141 2141
198 198
895 895
1231 1231
1478 1478
923 923
1398 1398
1103 1103
1226 1226
723 723
48 48
...

output:

1
0 14 16 18 20 22 29 31 32 33 76 83 85 86 99 101 107 123 138 144 160 183 185 186 187 188 189 196 198 201 209 211 213 214 220 222 224 245 247 250 258 260 283 293 295 300 301 314 316 318 343 345 347 349 368 371 373 375 377 379 381 382 389 391 397 404 410 417 419 421 461 482 483 484 486 488 507 509 51...

result:

wrong answer 1st lines differ - expected: '1574', found: '1'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Wrong Answer

Test #41:

score: 0
Wrong Answer
time: 59ms
memory: 11476kb

input:

250000 250000
159526 159526
198590 198590
55199 55199
129454 129454
149248 149248
230920 230920
158933 158936
215937 215937
173724 173724
151808 151808
168086 168086
218032 218035
153365 153365
70475 70475
68770 68779
121856 121856
143399 143400
124906 124906
92405 92405
149057 149057
124739 124739
...

output:

1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

wrong answer 1st lines differ - expected: '189514', found: '1'

Subtask #5:

score: 0
Wrong Answer

Test #47:

score: 0
Wrong Answer
time: 22ms
memory: 10408kb

input:

250000 212688
1 4
2 5
3 9
4 12
6 13
7 14
10 16
11 17
13 19
14 20
15 21
20 22
21 23
23 24
24 26
25 28
26 29
31 31
32 32
35 36
36 37
37 38
38 42
39 43
41 44
42 45
43 47
44 52
45 55
46 56
49 58
50 60
51 61
52 63
54 64
55 68
57 69
58 70
59 72
61 74
63 75
64 76
65 77
66 78
68 80
69 81
72 83
73 85
74 86
7...

output:

1
4 7 8 11 16 26 28 47 52 55 66 80 83 88 97 127 136 137 142 144 147 164 197 198 199 224 226 245 248 249 250 252 279 282 291 293 304 306 314 319 331 334 348 355 360 375 384 392 395 400 410 412 416 418 421 423 428 431 470 475 480 484 499 500 512 528 529 548 553 558 570 578 581 587 596 597 609 610 640 ...

result:

wrong answer 1st lines differ - expected: '1791', found: '1'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%