QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#719688 | #9606. PM 大师 | hos_lyric# | 10 | 403ms | 4340kb | C++14 | 2.3kb | 2024-11-07 08:02:15 | 2024-11-07 08:02:17 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
int N, Q;
vector<int> A;
vector<int> X, K, Y;
namespace brute {
vector<int> run() {
auto as = A;
vector<int> bs(N);
vector<int> app(N + 1, -1);
vector<int> ans(Q, -1);
for (int q = 0; q < Q; ++q) {
as[X[q]] = K[q];
int mex = 0;
for (int i = 0; i < N; ++i) {
if (as[i] == -1) {
for (; app[mex] == q; ++mex) {}
bs[i] = mex;
} else {
bs[i] = as[i];
}
if (bs[i] >= 0) {
app[bs[i]] = q;
}
}
ans[q] = bs[Y[q]];
}
return ans;
}
} // brute
int main() {
for (; ~scanf("%d%d", &N, &Q); ) {
A.resize(N);
for (int i = 0; i < N; ++i) {
scanf("%d", &A[i]);
--A[i];
}
X.resize(Q);
K.resize(Q);
Y.resize(Q);
for (int q = 0; q < Q; ++q) {
scanf("%d%d%d", &X[q], &K[q], &Y[q]);
--X[q];
--K[q];
--Y[q];
}
const auto ans = brute::run();
for (int q = 0; q < Q; ++q) {
printf("%d\n", ans[q] + 1);
}
}
return 0;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 4048kb
input:
10 10 0 -1 0 0 -1 0 -1 -1 0 -1 7 5 9 7 5 1 10 8 4 7 10 1 8 -1 3 10 6 4 2 2 1 2 9 6 5 8 4 7 -1 9
output:
6 1 3 1 2 3 1 4 3 5
result:
ok 10 lines
Test #2:
score: 10
Accepted
time: 403ms
memory: 4048kb
input:
10000 10000 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 -1 -1 0 0 -1 0 -1 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 0 0 -1 0 -1 -1 -1 -1 0 -1 -1 0 -1 -1 0 -1 -1 0 0 -1 0 0 0 -1 -1 -1 -1 0 0 0 0 -1 0 -1 -1 0 -1 -1 -1 0 0 -1 0 0 -1 -1 0 0 -1 -1 -1 -1 0 0 0 -1 0 -1 0 0 0 0 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 0 -1 -1 0 -1 -1 0...
output:
37 1767 2083 1505 2208 3174 1012 3136 4044 2661 802 4772 931 2188 605 732 1473 1221 4070 706 3786 464 300 2857 4852 3026 2965 2102 4096 4859 1841 60 2465 645 4312 2002 4168 3292 2854 2043 194 4748 3298 1687 916 4465 1101 4649 4552 598 3717 3883 2111 1911 2502 2265 2737 2193 4200 3607 4086 3908 2529 ...
result:
ok 10000 lines
Test #3:
score: 10
Accepted
time: 131ms
memory: 4340kb
input:
10000 10000 0 0 -1 0 0 -1 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 ...
output:
6984 1876 1755 3945 3988 8817 1301 9211 6838 70 2044 5300 4026 6870 1879 7611 2604 5187 8292 1796 5087 2635 2369 8040 5721 6993 5554 966 5743 4301 8644 4755 2400 4647 6158 6998 2597 7698 8252 6522 8528 8153 3332 2833 4289 3081 9022 6921 6121 1549 2801 958 9507 2148 7998 4954 8624 7643 22 4162 5666 8...
result:
ok 10000 lines
Test #4:
score: 10
Accepted
time: 146ms
memory: 4048kb
input:
10000 10000 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 ...
output:
549 7364 7058 4716 4807 6918 163 2855 4219 8220 1848 2315 1228 6516 1570 7755 728 911 2810 2028 3977 6371 8418 788 2040 7159 7360 3776 8573 8326 3057 3814 3587 4894 2018 5314 812 5691 5689 7967 4493 7806 1966 5618 6862 3303 1947 6878 7511 6879 5418 5836 8916 5951 4960 1424 1290 4315 873 3208 1774 73...
result:
ok 10000 lines
Test #5:
score: 10
Accepted
time: 211ms
memory: 4080kb
input:
10000 10000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 -1 -1 -1 -1 0 0 0 0 0 -1 -1 0 0 0 -1 0 0 0 0 -1 0 0 -1 0 0 0 -1 -1 0 -1 -1 0 -1 -1 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 -1 0 -1 0 0 -1 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 -1 0 -1 -1 0 0 0 ...
output:
3638 2094 6615 88 2643 3081 3993 7204 6569 1008 7035 4008 6846 2407 2888 6884 5588 340 3145 3234 3779 2608 6289 1428 2477 3411 161 2203 2128 5677 1759 2106 6596 313 7461 5011 1208 3021 7029 3452 4582 6173 479 4360 224 3681 5249 2351 569 1369 5212 5572 3429 7152 6636 6318 6928 6644 6678 5661 4229 185...
result:
ok 10000 lines
Test #6:
score: 10
Accepted
time: 238ms
memory: 4060kb
input:
10000 10000 -1 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 ...
output:
2420 325 2194 1102 1154 1391 12 1517 1948 1801 593 441 975 1902 1078 184 226 587 52 2361 1584 2137 2255 190 1904 193 636 62 1915 1028 1751 612 330 659 1700 1672 1073 756 202 425 766 522 1844 2295 744 37 865 2367 32 1066 948 1026 1162 812 625 1512 161 1394 2372 429 1232 1155 1295 998 1941 1632 1151 1...
result:
ok 10000 lines
Test #7:
score: 10
Accepted
time: 203ms
memory: 4336kb
input:
10000 10000 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0...
output:
219 484 774 725 570 54 54 931 240 552 787 897 322 15 756 440 675 152 337 275 408 856 622 562 494 3 890 858 849 460 141 187 119 271 441 426 550 804 308 823 398 918 244 522 213 785 84 429 428 500 619 179 808 173 853 1011 955 46 375 520 704 416 955 800 661 899 953 533 319 87 1011 172 254 810 842 879 59...
result:
ok 10000 lines
Test #8:
score: 10
Accepted
time: 197ms
memory: 4076kb
input:
10000 10000 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
236 370 232 128 262 311 250 336 164 107 97 183 354 3 346 307 282 350 99 214 350 489 170 373 130 81 221 200 184 275 451 67 60 70 41 472 153 479 288 228 212 332 68 76 338 114 242 116 207 22 234 204 451 213 258 159 34 193 259 122 448 105 131 177 474 490 439 405 170 322 380 360 425 33 414 302 191 161 33...
result:
ok 10000 lines
Subtask #2:
score: 0
Time Limit Exceeded
Test #9:
score: 0
Time Limit Exceeded
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #16:
score: 0
Time Limit Exceeded
input:
1000000 1000000 0 -1 -1 0 -1 -1 0 -1 0 -1 0 0 0 0 -1 -1 -1 0 -1 0 -1 0 -1 -1 0 -1 -1 -1 0 -1 -1 -1 0 -1 0 0 0 -1 -1 -1 -1 0 -1 -1 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 -1 -1 -1 0 0 0 -1 0 0 0 -1 -1 0 0 0 0 -1 -1 0 0 0 0 -1 0 -1 0 0 0...
output:
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #23:
score: 0
Time Limit Exceeded
input:
1000000 1000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #26:
score: 0
Time Limit Exceeded
input:
1000000 499990 -1 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 -1 0 0 0 -1 0 -1 -1 0 0 0 0 -1 -1 0 -1 -1 -1 0 -1 0 -1 0 -1 0 0 0 0 -1 0 -1 0 0 0 0 0 -1 0 -1 -1 -1 0 -1 -1 0 0 0 0 -1 -1 -1 0 0 0 -1 -1 0 0 -1 0 -1 -1 0 -1 -1 -1 0 0 0 -1 0 0 0 0 -1 0 0 -1 -1 0 -1 0 0 -1 -1 0 0 -1 0 0 0 -1 -1 -1 -1 0 -1 0 -1 -1 -1 0...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%