QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563099 | #4661. 冒泡排序 | Elegia | 100 ✓ | 1091ms | 69608kb | C++23 | 3.3kb | 2024-09-14 02:37:39 | 2024-09-14 02:37:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &x) {
int sgn = 1;
char ch;
x = 0;
for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
if (ch == '-') ch = getchar(), sgn = -1;
for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
x *= sgn;
}
template <class T>
void write(T x) {
if (x < 0) putchar('-'), write(-x);
else if (x < 10) putchar(x + '0');
else write(x / 10), putchar(x % 10 + '0');
}
const int _ = 1000005;
int L[_], R[_], V[_], disc[_], val[_];
bool fix[_];
vector<int> ops[_];
bool cmpL(int i, int j) {return L[i] > L[j];}
int mn[1 << 21], tag[1 << 21];
void build(int o, int l, int r) {
mn[o] = tag[o] = 0;
if (l == r) return;
int mid = (l + r) >> 1;
build(o << 1, l, mid); build(o << 1 | 1, mid + 1, r);
}
void apply(int o, int x) {mn[o] += x; tag[o] += x;}
void down(int o) {apply(o << 1, tag[o]); apply(o << 1 | 1, tag[o]); tag[o] = 0;}
void change(int o, int l, int r, int ql, int qr, int x) {
if (l == ql && r == qr) return apply(o, x);
down(o);
int mid = (l + r) >> 1;
if (qr <= mid) change(o << 1, l, mid, ql, qr, x);
else if (ql > mid) change(o << 1 | 1, mid + 1, r, ql, qr, x);
else {
change(o << 1, l, mid, ql, mid, x);
change(o << 1 | 1, mid + 1, r, mid + 1, qr, x);
}
mn[o] = min(mn[o << 1], mn[o << 1 | 1]);
}
int query(int o, int l, int r, int ql, int qr) {
if (l == ql && r == qr) return mn[o];
down(o);
int mid = (l + r) >> 1;
if (qr <= mid) return query(o << 1, l, mid, ql, qr);
else if (ql > mid) return query(o << 1 | 1, mid + 1, r, ql, qr);
else return min(query(o << 1, l, mid, ql, mid), query(o << 1 | 1, mid + 1, r, mid + 1, qr));
}
int main() {
int T; read(T);
while (T--) {
int N, M; read(N); read(M);
for (int i = 1; i <= M; ++i) {read(L[i]); read(R[i]); read(V[i]);}
copy(V + 1, V + M + 1, disc + 1);
sort(disc + 1, disc + M + 1);
int cnt = unique(disc + 1, disc + M + 1) - disc - 1;
for (int i = 1; i <= M; ++i) {
V[i] = lower_bound(disc + 1, disc + cnt + 1, V[i]) - disc;
ops[V[i]].push_back(i);
}
set<int> st; for (int i = 1; i <= N + 1; ++i) st.insert(i);
bool flag = true;
fill(val + 1, val + N + 1, 1);
fill(fix + 1, fix + N + 1, false);
for (int i = cnt; i; --i) {
sort(ops[i].begin(), ops[i].end(), cmpL);
int lst = N + 1;
for (int j : ops[i]) {
if (lst <= R[j]) continue;
auto it = st.lower_bound(L[j]);
if (*it > R[j]) {flag = false; break;}
fix[lst = *it] = true;
}
if (!flag) break;
for (int j : ops[i]) {
auto it = st.lower_bound(L[j]);
while (*it <= R[j]) {
val[*it] = i;
st.erase(it++);
}
}
}
for (int i = cnt; i; --i) ops[i].clear();
if (!flag) {write(-1); putchar('\n'); continue;}
build(1, 1, N);
for (int i = 1; i <= N; ++i) {if (val[i] > 1) change(1, 1, N, 1, val[i] - 1, 1);}
long long ans = 0, sum = 0;
for (int i = N; i; --i) {
if (!fix[i]) ans += query(1, 1, N, val[i], N);
if (val[i] > 1) change(1, 1, N, 1, val[i] - 1, -1);
if (fix[i] && val[i] < N) change(1, 1, N, val[i] + 1, N, 1);
}
for (int i = 1; i <= N; ++i) if (fix[i]) {
ans += query(1, 1, N, val[i], val[i]);
if (val[i] < N) change(1, 1, N, val[i] + 1, N, -1);
}
write(ans); putchar('\n');
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 4
Accepted
time: 5ms
memory: 16032kb
input:
1000 5 5 1 1 858101125 3 5 45155772 3 3 45155772 2 5 45155772 3 3 45155772 5 5 5 5 853781632 1 1 947533428 1 5 636405388 1 1 947533428 5 5 853781632 5 5 2 2 988056869 3 4 921460776 3 3 921460776 2 3 921460776 4 4 921460776 5 5 2 2 851264618 2 3 251689515 1 1 851264618 5 5 468952799 5 5 468952799 5 5...
output:
2 4 2 5 4 2 2 2 1 4 4 -1 4 4 4 4 3 -1 3 3 3 2 3 4 3 3 1 2 4 -1 2 3 0 0 4 7 1 -1 5 1 6 4 4 -1 2 -1 3 0 4 3 1 4 4 1 4 3 0 2 2 4 3 4 4 5 3 1 4 4 3 3 -1 2 4 2 5 1 2 4 2 0 3 3 3 1 3 1 3 2 5 5 2 3 3 4 7 2 4 2 4 2 4 6 3 0 4 0 3 4 3 0 6 0 2 4 2 1 0 5 3 3 2 1 6 2 5 3 5 2 4 3 5 0 3 3 0 -1 6 3 2 0 3 0 3 0 4 4 ...
result:
ok 1000 numbers
Test #2:
score: 4
Accepted
time: 0ms
memory: 17856kb
input:
1000 5 5 3 4 475476903 5 5 203163173 1 1 317558590 4 4 475476903 3 3 475476903 5 5 1 1 616038815 2 5 175040717 2 2 616038815 2 2 616038815 2 5 175040717 5 5 3 3 214612812 2 2 683983692 1 2 609687798 2 2 683983692 4 4 273080121 5 5 5 5 852056410 1 3 167695638 5 5 852056410 4 4 540243370 1 1 852056410...
output:
4 2 4 3 2 3 2 3 -1 1 1 2 5 2 4 4 2 2 0 -1 3 3 2 3 0 -1 3 3 0 3 4 2 2 4 4 1 5 2 4 0 3 5 4 7 7 1 2 3 5 2 0 3 2 0 3 2 4 5 4 6 2 3 2 6 7 2 2 2 3 3 1 1 6 6 0 3 1 0 3 3 1 6 2 2 0 4 1 2 2 3 5 0 2 0 3 3 3 6 4 5 5 4 4 3 1 4 3 4 0 4 3 5 3 3 0 6 0 0 2 1 -1 1 0 0 0 1 0 0 2 0 5 3 4 4 6 0 4 3 3 2 0 5 2 5 0 5 5 0 ...
result:
ok 1000 numbers
Test #3:
score: 4
Accepted
time: 2ms
memory: 17936kb
input:
1000 5 5 1 5 143563917 5 5 842495845 4 4 757804194 3 3 143563917 3 5 143563917 5 5 2 5 886930326 3 3 886930326 3 3 886930326 3 3 886930326 5 5 886930326 5 3 1 2 677026925 1 2 362136951 2 2 24734357 5 5 1 1 875045749 1 1 875045749 3 3 946987527 2 3 875045749 4 5 631589823 5 5 4 4 306735891 2 2 440690...
output:
0 0 -1 3 3 0 0 5 6 2 4 2 5 4 2 2 3 4 2 3 5 2 3 3 3 2 3 3 2 1 1 0 4 5 1 4 2 2 -1 3 0 2 4 -1 4 2 2 2 4 3 0 5 6 0 2 1 2 4 2 0 3 6 4 2 3 3 3 2 2 4 3 1 1 1 3 3 2 4 1 3 -1 5 2 6 3 3 2 2 5 4 1 3 3 3 4 4 2 5 3 1 3 6 3 3 2 0 1 3 -1 6 0 2 3 4 2 4 2 4 5 3 2 5 4 1 2 3 3 2 0 -1 2 2 2 7 4 0 2 3 4 5 1 2 3 3 3 4 4 ...
result:
ok 1000 numbers
Test #4:
score: 4
Accepted
time: 5ms
memory: 15892kb
input:
1000 5 5 4 4 322793446 3 5 322793446 3 3 340244688 4 4 322793446 4 4 322793446 5 5 4 4 45434088 1 5 45434088 3 5 45434088 3 3 114708395 2 2 315073910 5 5 4 4 490209133 1 1 709002321 1 4 38065925 4 4 490209133 4 5 38065925 5 5 1 4 601944929 5 5 601944929 2 2 648219288 1 2 648219288 5 5 601944929 5 5 ...
output:
1 3 5 5 3 3 2 1 5 1 5 5 5 4 3 4 0 4 3 4 5 2 4 5 0 4 4 5 2 3 5 2 3 4 2 2 2 0 1 0 2 0 2 2 4 0 4 0 3 2 6 7 3 2 4 3 7 4 2 2 4 2 0 5 4 4 0 3 0 1 0 0 1 0 3 4 2 0 2 -1 3 2 3 0 5 1 3 2 2 0 -1 4 7 0 4 0 0 0 1 4 1 4 6 3 6 3 -1 0 2 0 0 2 4 4 4 2 2 4 4 4 4 5 2 3 2 2 2 5 0 5 0 0 5 -1 2 0 2 1 5 4 6 0 3 -1 3 2 3 3...
result:
ok 1000 numbers
Test #5:
score: 4
Accepted
time: 0ms
memory: 15892kb
input:
1000 9 9 5 8 0 3 4 1 4 4 1 3 4 1 8 9 0 2 4 0 3 3 1 5 6 0 7 8 0 9 9 9 9 0 5 8 0 6 7 1 1 2 1 5 6 1 1 8 0 1 2 1 7 9 0 6 8 0 9 9 2 8 0 6 7 1 3 3 1 5 6 1 2 5 0 1 1 1 2 8 0 2 8 0 2 6 0 9 9 8 9 1 5 6 1 4 7 0 1 1 1 1 2 0 4 7 0 1 6 0 6 6 1 3 8 0 9 9 3 5 0 5 6 1 3 3 1 1 3 0 6 7 0 2 3 1 1 8 0 4 5 0 2 3 1 9 8 8...
output:
6 14 1 3 6 -1 15 1 3 -1 9 -1 5 0 7 -1 0 2 0 -1 5 5 0 8 6 -1 12 -1 3 3 1 2 0 2 15 6 3 -1 3 -1 4 5 5 11 0 10 3 2 3 0 7 1 8 6 6 3 2 7 10 -1 -1 2 7 5 7 4 0 3 13 10 13 8 0 0 -1 2 1 -1 0 8 5 -1 17 5 1 2 6 7 7 0 8 1 2 1 0 7 4 4 9 8 -1 -1 -1 14 4 4 5 5 2 1 5 6 3 0 12 0 10 3 3 0 0 2 -1 2 7 2 0 8 8 -1 6 12 0 ...
result:
ok 1000 numbers
Test #6:
score: 4
Accepted
time: 5ms
memory: 15888kb
input:
1000 9 9 1 1 0 7 8 1 4 7 0 2 3 0 6 6 1 8 8 1 3 5 0 7 8 1 1 2 0 9 9 7 9 1 3 7 0 3 6 0 1 6 0 2 3 1 3 8 0 3 4 0 5 7 1 1 2 1 9 9 2 2 1 3 6 0 1 2 0 8 8 1 8 9 0 3 4 1 7 8 0 8 8 1 3 6 0 9 9 7 9 0 1 4 1 5 8 1 9 9 0 5 7 1 2 9 0 4 5 1 3 9 0 8 9 0 9 9 2 7 1 2 7 1 1 1 1 6 9 1 2 7 1 2 7 1 6 9 1 7 8 1 1 1 1 9 9 2...
output:
0 3 12 8 0 3 -1 14 4 7 10 3 1 4 3 4 0 4 0 6 0 -1 7 6 6 1 0 8 5 4 -1 7 7 4 3 4 2 3 2 0 1 3 0 5 0 7 6 -1 6 8 2 3 3 8 3 5 2 9 2 4 2 11 8 2 8 0 9 7 -1 12 4 5 16 6 4 0 3 4 0 7 0 9 0 4 0 -1 9 3 4 16 25 6 9 1 0 0 13 3 8 5 -1 5 0 5 6 7 9 7 8 5 4 7 3 0 0 6 6 0 6 5 0 1 4 6 14 4 4 9 5 9 1 3 -1 1 7 1 7 7 9 5 1 ...
result:
ok 1000 numbers
Test #7:
score: 4
Accepted
time: 5ms
memory: 16048kb
input:
1000 9 9 1 5 0 2 3 1 5 5 0 4 4 1 6 8 0 9 9 1 1 3 0 6 6 1 4 6 0 9 9 3 5 1 3 3 1 3 4 1 4 5 1 9 9 0 3 6 0 8 9 0 5 6 0 1 4 0 9 9 3 9 0 3 3 1 6 7 1 5 9 0 1 8 0 2 2 1 2 9 0 5 9 0 2 3 1 9 9 9 9 1 4 5 0 7 9 0 6 6 0 2 3 1 1 1 0 2 3 1 9 9 1 1 3 0 9 9 4 9 0 3 8 0 3 5 1 2 5 0 4 5 1 3 5 1 4 7 0 5 6 1 1 1 0 9 9 3...
output:
7 8 3 8 4 16 5 5 3 3 4 -1 6 8 0 11 6 -1 0 6 6 7 8 4 2 8 0 6 4 0 6 5 12 4 6 6 4 11 2 -1 4 0 3 3 -1 6 7 5 -1 8 9 3 4 -1 11 -1 5 3 4 2 2 10 0 9 3 5 6 1 7 1 -1 11 5 4 7 3 1 0 1 0 -1 -1 0 6 15 0 4 9 0 3 6 7 7 6 12 4 5 7 3 -1 1 1 2 10 6 8 2 10 0 0 1 5 8 4 -1 7 3 5 -1 6 0 7 6 10 4 0 2 -1 4 1 3 9 14 3 -1 4 ...
result:
ok 1000 numbers
Test #8:
score: 4
Accepted
time: 6ms
memory: 15808kb
input:
1000 20 20 13 16 0 5 18 0 3 3 1 4 6 1 17 17 1 8 8 1 1 1 1 1 3 0 15 15 1 4 4 1 9 10 0 11 12 0 6 9 0 10 12 0 4 4 1 16 19 0 3 3 1 3 15 0 4 5 1 11 12 0 20 20 5 15 0 2 4 0 4 11 0 17 17 1 12 12 0 3 9 0 2 2 1 17 18 1 17 17 1 18 18 1 5 11 0 13 13 1 1 1 0 11 11 1 5 7 0 8 8 1 10 13 0 20 20 1 12 14 0 17 18 1 2...
output:
28 10 34 37 26 -1 30 2 31 101 -1 -1 12 11 -1 26 34 32 -1 25 -1 -1 18 31 -1 60 14 17 -1 132 16 41 131 15 -1 38 102 25 -1 16 16 31 34 26 49 11 7 -1 194 15 27 24 597 -1 26 98 12 18 -1 54 31 23 -1 33 52 16 19 42 46 32 -1 15 31 165 42 154 66 16 37 11 18 13 -1 -1 -1 118 13 24 -1 -1 36 19 31 172 35 4 16 96...
result:
ok 1000 numbers
Test #9:
score: 4
Accepted
time: 5ms
memory: 17908kb
input:
1000 20 20 6 6 0 8 9 1 5 19 0 14 17 1 1 2 0 14 15 1 13 14 1 3 5 0 10 17 0 4 7 0 10 13 0 5 16 0 3 4 0 6 8 0 5 5 1 16 17 1 8 9 1 16 20 1 13 15 1 5 5 1 20 20 10 10 1 14 20 0 6 12 0 15 16 1 7 9 1 7 7 1 14 15 1 1 2 0 14 20 0 8 10 1 13 18 0 9 20 0 8 12 0 17 18 1 5 7 0 8 10 1 9 11 1 10 11 1 2 4 0 19 20 0 2...
output:
5 20 1 36 44 23 37 -1 26 44 50 18 10 18 51 67 141 13 -1 -1 39 8 -1 27 21 19 -1 10 25 -1 15 35 7 35 5 586 0 20 12 114 35 15 19 29 37 38 37 5 5 19 29 -1 -1 40 21 25 27 27 32 25 18 -1 28 22 30 38 11 223 19 26 23 154 -1 6 18 16 44 38 6 12 40 38 3 39 48 143 17 30 103 -1 23 111 8 7 27 -1 25 17 23 5 508 14...
result:
ok 1000 numbers
Test #10:
score: 4
Accepted
time: 10ms
memory: 18080kb
input:
1000 20 17 1 2 1 6 12 0 2 5 1 1 4 0 3 8 0 3 4 0 2 3 1 4 9 1 8 8 1 14 14 0 3 5 1 8 9 0 7 9 1 7 8 0 3 4 0 5 10 0 1 3 1 50 50 31 31 1 41 44 1 26 27 1 25 26 1 13 13 0 1 29 0 23 48 0 25 27 1 21 28 0 1 1 1 3 3 1 24 25 1 24 25 1 9 11 0 17 18 0 46 46 1 29 29 0 16 16 1 21 30 0 26 26 1 25 27 1 26 26 1 8 9 0 2...
output:
-1 130 12 23 13 32 10 -1 -1 163 32 20 15 165 36 42 37 21 21 438 25 11 19 34 43 11 26 28 22 20 24 42 28 3 3 29 37 265 33 -1 130 -1 17 -1 15 21 17 18 30 16 38 0 -1 -1 -1 42 20 25 44 -1 6 25 7 13 28 -1 13 48 11 26 17 22 90 36 24 -1 8 23 29 13 37 -1 23 24 29 29 34 26 160 13 166 0 -1 412 615 15 30 24 12 ...
result:
ok 1000 numbers
Test #11:
score: 4
Accepted
time: 23ms
memory: 17972kb
input:
1000 60 60 27 27 0 49 51 0 36 52 0 31 33 0 12 22 1 7 59 0 11 19 1 4 10 1 48 48 1 54 54 1 34 34 1 26 53 0 40 48 0 48 49 0 38 59 0 11 50 0 54 54 1 34 34 1 8 10 1 25 26 1 52 55 0 5 14 1 2 4 1 2 11 1 14 23 1 4 24 0 37 38 1 7 15 1 6 13 1 39 40 0 59 59 0 32 35 0 3 29 0 31 54 0 42 45 0 33 36 0 43 44 1 42 4...
output:
390 187 -1 2778 186 264 238 252 272 217 304 338 -1 419 201 252 165 265 330 151 123 365 -1 43 341 319 231 -1 94 412 304 178 242 -1 272 173 181 143 137 239 287 233 -1 301 255 231 4302 4239 231 97 3018 166 177 -1 169 226 285 248 -1 -1 299 105 172 152 284 215 316 396 250 187 268 2729 334 303 157 159 466...
result:
ok 1000 numbers
Test #12:
score: 4
Accepted
time: 33ms
memory: 17932kb
input:
1000 60 60 17 17 1 11 11 1 7 31 0 2 2 1 14 14 1 34 34 1 2 2 1 57 57 1 28 28 1 37 38 0 57 57 1 26 27 0 16 16 1 57 57 1 33 54 0 22 23 0 16 17 1 17 17 1 32 53 0 22 22 1 29 30 0 21 53 0 16 16 1 3 55 0 17 17 1 26 26 0 16 17 1 5 6 0 7 16 0 59 60 1 49 49 1 16 16 1 9 18 0 20 33 0 16 17 1 4 4 0 25 25 0 40 40...
output:
107 236 288 86 204 274 1403 254 296 2013 372 227 253 226 163 -1 -1 -1 175 121 277 276 232 2924 114 170 -1 262 2241 129 222 193 -1 298 193 249 188 1439 65 542 380 223 337 133 301 118 -1 191 193 268 266 187 299 155 381 285 317 233 221 144 1890 203 -1 193 204 125 -1 343 208 125 320 142 186 240 167 274 ...
result:
ok 1000 numbers
Test #13:
score: 4
Accepted
time: 35ms
memory: 18124kb
input:
1000 60 60 29 29 846968105 5 5 76099645 9 9 303521817 5 5 76099645 5 5 76099645 11 11 511567403 37 37 662628050 59 59 23819844 18 18 609622075 11 11 511567403 31 31 670156463 4 4 63198943 37 37 662628050 37 37 662628050 37 37 662628050 44 44 540793777 5 5 76099645 44 44 540793777 39 39 565900703 59 ...
output:
249 275 -1 597 435 228 475 333 3338 629 208 639 6436 231 498 386 381 407 483 462 365 509 360518 175 346 526 512 549 462 -1 242 3598 3505 245 499 454 4680 346 227 434 348 267 231 407 171 171 347 452 362 192 392 476900 457 282 248 519 258 263 548 4220 404 303 289 241 424 483 4987 298 467 6560 160 355 ...
result:
ok 1000 numbers
Test #14:
score: 4
Accepted
time: 33ms
memory: 18104kb
input:
1000 60 60 36 36 717080061 5 5 174299567 37 37 754927425 59 59 72403092 55 55 72403092 55 55 72403092 39 39 676721698 59 59 72403092 9 9 373231944 37 37 754927425 1 1 72403092 38 38 581435328 7 7 206883936 48 48 527441277 55 55 72403092 24 24 825284002 48 48 527441277 40 40 581435328 59 59 72403092 ...
output:
358 239 230 246 381 305 6013 384 4020 614 567 444 275 404 202 -1 299 398 593 267 272 162 435 343 232 583 6337 267 521 363 6608 410 5505 477 349 451 320 469 389 5528 329 3953 298 255 491 568 441 -1 387 272 363 178 454 540 485 4775 350 407 494 306 5680 424 449 477 393 610 -1 346 275 3243 426 5848 356 ...
result:
ok 1000 numbers
Test #15:
score: 4
Accepted
time: 26ms
memory: 18100kb
input:
1000 60 15 10 10 470056122 6 6 120473254 25 51 345110813 14 15 345110813 53 53 276989817 19 19 767146686 11 12 331029748 3 4 116953758 9 9 331029748 21 22 891249223 57 58 116953758 20 20 470984049 13 13 959061108 7 7 148735964 16 18 939094460 60 30 34 34 845955326 53 53 941670276 58 58 771402070 44 ...
output:
126 337 477 135 212 78 256 271 424 129 507 515 213 118 294 314 106 187 141 232 566 274 259 236 239 374 462 256 5100 531 3856 475 218 257 402 449 279 495 245 6628 267 2909 202 144 5534 246 114 510 96 115 638 543 480 494 476 484 686 287 378 127 187 228 239 512211 470 123 464 188 596 3029 395 161 509 2...
result:
ok 1000 numbers
Test #16:
score: 4
Accepted
time: 26ms
memory: 18108kb
input:
1000 60 15 47 47 915834370 14 17 942238138 1 1 156995254 53 53 598050296 40 42 988010007 55 55 495285538 13 13 598050296 54 54 899587752 11 12 228879737 59 60 649894082 3 5 114486731 50 52 899587752 43 46 789474385 57 58 145755193 6 9 649894082 60 15 21 22 201472052 56 59 650144424 54 55 201472052 3...
output:
313 227 326 213 191 660 153 236 185 104 149 438 3074 162 132 397 337 223 2968 372 448 328 343 2799 430 238 231 457 489 6001 177 288 419 491 254 269 332 5436 629 109 346 2206 164 545 237 432 2162 146 528 84 483 219 288 557 242 500 4615 254 3134 150 142 145 224 341 4911 5151 2604 113 476 496 433 161 4...
result:
ok 1000 numbers
Test #17:
score: 4
Accepted
time: 39ms
memory: 16252kb
input:
1000 60 60 21 21 617173550 57 60 127011965 1 2 31115661 15 46 308111760 36 36 972339856 28 41 670299986 12 12 646001486 7 7 61804036 33 33 993209045 32 32 977126213 21 56 97589458 33 33 993209045 22 22 723266179 31 47 308111760 20 20 771478230 59 60 127011965 24 24 686059893 31 32 977126213 33 33 99...
output:
553 725 337 395 5137 4818 273 554 372 475 5247 490 516 724 437 313 466 510 5677 450 310 503 389 546 432 565 348 386 396 370 5793 482 -1 886 517 587 632 6475 322 747 410 4974 506 416 7271 530 362 571 536 -1 223 599 4891 6471 358 545 431 -1 530 480 352 732 561 638 466 450 565 301 -1 384 669 547 312 30...
result:
ok 1000 numbers
Test #18:
score: 4
Accepted
time: 41ms
memory: 18120kb
input:
1000 60 60 19 19 245765990 48 48 510534919 42 43 884988833 36 36 900991314 37 52 457332142 42 42 889019581 47 53 457332142 27 27 676337341 39 47 482079745 13 14 130615726 53 53 463480241 22 24 400868271 16 18 245765990 43 43 884988833 30 31 886301513 17 17 380110766 25 25 643393441 58 58 262324552 4...
output:
394 6315 587 660 421 283 440 382 470 498 472 551 387 -1 400 349 386 629 456 413 435 -1 476 462 414 396 4871 625 457 -1 317 459 594 413 323 551 605 -1 411 456 -1 -1 -1 430 461 438 409 -1 489 477 664 562 456 461 -1 4845 303 4834 582 4551 417 492 447 423 428 4946 564 420 -1 646 763 547 425 486 594 561 ...
result:
ok 1000 numbers
Test #19:
score: 4
Accepted
time: 884ms
memory: 59544kb
input:
1000 100 100 58 58 1 87 93 0 89 90 0 70 70 0 96 98 0 33 40 1 27 30 1 84 87 0 71 72 1 35 48 1 66 66 1 1 2 1 2 3 0 57 59 0 60 61 0 36 51 0 23 33 1 35 36 1 80 88 0 77 78 0 3 7 0 45 48 1 22 82 0 11 26 0 63 64 0 96 98 0 18 18 1 69 87 0 84 84 0 88 92 0 17 28 1 54 57 0 23 38 1 90 91 0 64 91 0 92 100 0 64 7...
output:
1026 609 317 812 517 702 799 666 362 631 -1 663 708 470 93545 467 500 559 428 430 982 769 354 805 686 842 550 467 533 -1 625 871 -1 -1 -1 574 420 704 1055 1291 889 593 388 338 684 574 852 310 546 106872 515 735 1189 827 -1 349 582 554 544 -1 1139 422 1037 905 -1 1332 374 -1 317 635 639 393 1107 372 ...
result:
ok 1000 numbers
Test #20:
score: 4
Accepted
time: 1045ms
memory: 69360kb
input:
1000 100 100 34 34 688114363 13 13 497602975 24 24 584099836 1 1 11064457 79 79 688114363 75 75 730344411 6 6 55402879 85 85 531504230 53 53 957497023 34 34 688114363 65 65 818408029 17 17 531504230 2 2 39322045 13 13 497602975 96 96 187506827 54 54 912106974 78 78 663018471 12 12 446827625 24 24 58...
output:
695 874 -1 1297 351269 791 798 567 974 1176 828 -1 862 358267 30409965701 907 891 672 904 1158 1186 781 -1 650 768 1062 782 496244 1395 1047 859 1272 1268 1259 1312 961 -1 652 1039 1118 928 828 672 849 1284 967 1030 1082 959 705 977 857 642 770 929 923 357365 1008 965 716 1147 448 -1 759 861 1213 11...
result:
ok 1000 numbers
Test #21:
score: 4
Accepted
time: 1050ms
memory: 69608kb
input:
1000 60 20 60 60 942112724 59 59 818007205 27 27 119602231 53 53 282291455 50 51 827055025 32 32 268551385 6 6 298330697 29 30 380864207 42 42 212833661 45 46 919717370 3 3 156975391 1 1 603866085 35 37 683064053 8 12 156975391 19 19 119602231 47 47 457525336 24 26 212833661 28 28 309428776 13 13 12...
output:
192 6289 481 183 421 6642 6128 303 348 444 7571 514 7928 553 5992 421 345 331 357 342 535 389 432 7033 434 258 591 226523 580 607 8259 494 486 5952 438 6807 367 252 631 6354 301 6786 328 330 6642 347 322 452 429 566 675 8218 433 6154 245 6422 483 7055 8116 423 379 369 6874 428 7812 357 178 7376 607 ...
result:
ok 1000 numbers
Test #22:
score: 4
Accepted
time: 1091ms
memory: 65904kb
input:
1000 60 30 15 15 757387674 31 32 512028424 3 3 383777378 55 55 3261047 4 5 959566034 28 28 710034316 1 1 383777378 7 8 959566034 33 34 978306846 9 9 812990862 35 35 694413005 57 58 998209632 48 48 710034316 43 43 558583141 24 24 523316637 12 13 383777378 2 2 410596152 20 22 757387674 25 25 414849827...
output:
398 5638 310 353 660 393 571 401 119 480 467 6700 519 413 459 6386 314 6641 259 6757 203 339 470 186 279 467 8123 655 7322 301 400 289 314 197 560 121 6687 295 421 459 577 555 8237 126 384 157 478 639 6230 356 663 280 391 473 524 7373 7136 643 326 549696 7671 214 243 360 389 710 554 736 6111 560 655...
result:
ok 1000 numbers
Test #23:
score: 4
Accepted
time: 1002ms
memory: 62268kb
input:
1000 2000 1141 1948 1948 690337598 1402 1402 538280428 1977 1978 146998878 1859 1923 9534484 405 405 771478660 1042 1042 690337598 1626 1657 9534484 1714 1715 423391004 595 595 596139683 490 490 535759446 1975 1975 196908343 706 706 531410880 386 386 574075759 654 654 938529881 483 1824 9534484 910 ...
output:
437915 1312 1063 1637 1006 816 1389 1305 1494 1328 1268 916 1444 621143 891 1490 1065 1191 1940 1216 1279 1177 1410 1382 1108 1390 2305 1742 1331 1164 1180 1258 1112 1009 1776 1722 1615 1439 1598 658471 1218 1321 1421 1377 1103 1824 1058 1509 1839 1593 965 1594 1438 929 1238 1373 1410 1380 1522 1510...
result:
ok 1000 numbers
Test #24:
score: 4
Accepted
time: 1076ms
memory: 61848kb
input:
1000 100 100 67 67 946316098 66 68 573117842 78 79 579757212 35 35 898080439 86 86 479313287 78 79 579757212 11 11 490051864 34 97 10860417 4 4 828409746 59 60 338034291 23 23 828409746 56 96 10860417 21 24 306342291 86 86 479313287 29 32 127019695 95 95 123780319 72 100 10860417 59 61 338034291 38 ...
output:
1462 31249702046 1212 1339 1616 1374 1197 1135 1323 927 1460 1088 1155 1495 1109 1555 971 2232 1220 1169 1350 1209 1357 1083 1207 1752 1090 1420 1184 1083 1013 1124 1637 1235 1152 1054 1206 1874 1176 1198 1063 1532 1263 377051 594 1392 1841 1184 1146 1679 1402 1123 1056 1234 484864 997 1360 1595 150...
result:
ok 1000 numbers
Test #25:
score: 4
Accepted
time: 989ms
memory: 63356kb
input:
1000 100 100 6 6 178494861 32 32 746488125 77 78 706988738 16 19 278472336 64 66 659855628 34 96 104697133 52 60 746488125 55 55 993751836 44 44 857161991 65 65 724449099 15 18 323519514 32 32 746488125 11 72 261586535 97 97 212022978 44 44 857161991 3 3 84105221 52 56 921920697 77 77 707324951 35 7...
output:
1618 1489 1252 1795 1062 1224 1206 1453 1785 1819 1185 1434 446580 1447 1089 1680 1763 1858 1107 1177 1273 1602 1082 1089 1019 1812 1450 954 1265 1086 1012 1932 1559 1775 1752 1381 1185 1345 1122 1082 1129 1189 989 1268 481356 415415 1361 717 868 2012 1267 1255 1382 1549 1359 1936 784 1492 1713 1323...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed