QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#425402 | #8672. 排队 | zhoukangyang# | 0 | 1050ms | 61188kb | C++14 | 863b | 2024-05-30 10:26:49 | 2024-05-30 10:26:50 |
Judging History
answer
#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define sz(a) ((int) (a).size())
#define vi vector < int >
#define me(a, x) memset(a, x, sizeof(a))
#define ull unsigned long long
#define ld __float128
#define pb emplace_back
using namespace std;
const int N = 1 << 21;
int n, q;
int l[N], r[N];
int ql[N], qr[N];
vi vc[N];
int a[N], ans[N];
int main() {
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> q;
L(i, 1, n) cin >> l[i] >> r[i];
L(i, 1, q) cin >> ql[i] >> qr[i], vc[qr[i]].pb(i);
L(i, 1, n) {
int L = 1;
while(a[L] > r[i]) ++L;
int R = i;
while(a[R] < l[i]) --R;
L(t, L, R) ++a[t];
for(auto&u : vc[i]) {
ans[u] = a[ql[u]];
}
}
L(i, 1, q) cout << ans[i] << '\n';
return 0;
}
詳細信息
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 10
Accepted
time: 9ms
memory: 52940kb
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
Accepted
time: 24ms
memory: 53660kb
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:
ok 5000 numbers
Test #3:
score: 0
Accepted
time: 90ms
memory: 53596kb
input:
5000 5000 33 36 10 96 0 89 45 59 4 38 16 26 7 83 3 45 37 78 32 57 19 58 24 88 81 87 24 68 18 38 50 78 27 92 61 98 1 13 8 63 33 55 38 76 18 43 64 72 24 93 7 34 1 38 44 72 5 36 62 71 6 72 8 53 22 93 75 78 24 69 10 38 31 99 12 100 57 67 22 65 34 44 37 88 3 48 62 84 62 79 5 68 1 18 49 57 45 64 6 38 37 3...
output:
101 101 101 101 63 101 101 101 99 100 28 86 101 92 101 101 101 101 101 101 101 101 99 101 101 101 101 92 101 101 4 101 101 101 101 101 101 74 101 101 101 101 101 101 41 101 101 51 101 101 101 101 101 101 101 100 101 101 100 101 101 101 101 101 94 101 101 101 101 101 101 46 101 99 101 101 7 101 95 10...
result:
ok 5000 numbers
Test #4:
score: 0
Accepted
time: 733ms
memory: 54836kb
input:
5000 5000 332 468 241 278 90 259 397 412 212 317 55 238 173 296 176 184 67 260 51 95 117 184 37 276 122 441 226 401 43 244 127 186 34 493 38 221 3 4 67 122 45 486 5 91 64 158 74 394 134 188 229 265 155 422 221 403 176 252 28 98 94 250 133 133 107 281 13 347 154 209 203 271 12 325 33 318 181 220 27 2...
output:
500 11 490 491 501 2 7 490 468 140 501 494 215 1 499 186 494 483 495 483 0 85 31 1 345 492 24 0 443 24 1 500 484 466 501 498 500 496 0 89 396 1 84 324 500 491 436 471 436 430 484 185 358 367 484 488 38 332 13 0 411 28 498 501 498 307 55 258 101 376 139 455 299 501 119 20 501 14 500 501 273 291 1 107...
result:
ok 5000 numbers
Test #5:
score: 0
Accepted
time: 1050ms
memory: 61188kb
input:
5000 5000 67 104 31 155 488 834 533 622 20 899 560 652 91 910 362 683 173 699 241 251 130 644 276 631 712 926 54 840 142 440 88 566 387 997 54 771 579 866 107 862 241 467 26 289 448 701 482 584 118 632 120 419 480 654 271 699 78 621 251 509 140 689 213 356 681 930 371 412 0 142 590 853 557 711 387 5...
output:
13 5 586 0 215 95 471 38 4 268 134 731 118 855 701 5 36 868 2 713 23 47 0 615 390 406 251 9 913 163 841 15 1 829 61 152 111 3 468 517 112 6 6 243 31 0 9 752 187 208 105 0 229 242 773 340 0 34 0 686 22 112 65 13 231 867 911 177 83 3 125 22 43 22 47 186 87 416 871 7 0 38 187 743 357 645 144 854 6 20 6...
result:
ok 5000 numbers
Test #6:
score: -10
Time Limit Exceeded
input:
5000 5000 1484 3115 596 3914 2334 3936 2782 3399 176 1270 3695 4175 4185 4222 2165 2301 321 4460 33 35 679 1844 443 2424 292 520 796 995 1014 4510 1053 3456 589 4211 514 3195 449 4153 1314 4247 1388 1736 1301 2724 1555 1950 413 4176 3501 4606 396 1492 521 2047 125 3192 677 1709 317 1833 444 1562 120...
output:
result:
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%