QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#578635 | #9260. Raiffeisenbank Logistics | AWR# | ML | 523ms | 218308kb | C++20 | 2.0kb | 2024-09-20 20:32:25 | 2024-09-20 20:32:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = int;
using pll = pair<ll, ll>;
#define fir first
#define sec second
#define mpr make_pair
#define vv vector
#define eb emplace_back
#define Fr(i, l, r) for (ll i = l; i <= r; ++i)
#define Rf(i, r, l) for (ll i = r; i >= l; --i)
const int INF = 1e9;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll T; cin >> T;
while (T --> 0) {
ll n, m; cin >> n >> m;
using type = array<ll, 4>;
vv<type> b;
vv<vv<ll>> h(n + 2);
vv<vv<ll>> id(n + 2);
vv<ll> siz(n + 2);
vv<map<ll, ll>> rk(n + 2);
Fr (i, 1, m) {
ll u, v, t;
cin >> u >> v >> t;
b.eb(type{u, v, 0, t});
b.eb(type{v, u, 1, t});
h[u].eb(t), h[v].eb(t);
}
ll cnt = 0;
Fr (i, 1, n) {
sort(h[i].begin(), h[i].end());
h[i].erase(unique(h[i].begin(), h[i].end()), h[i].end());
siz[i] = h[i].size() + 1, id[i].resize(siz[i] + 2);
Fr (j, 1, siz[i] - 1) rk[i][h[i][j - 1]] = j, id[i][j] = ++cnt;
id[i][siz[i]] = ++cnt;
}
// Fr (i, 1, n) cout << siz[i] << "\n";
vv<vv<pll>> G(cnt + 2);
Fr (i, 1, n) Fr (j, 1, siz[i] - 1) G[id[i][j]].eb(id[i][j + 1], 0);
for (auto [u, v, w, t] : b) {
ll t1 = rk[v][t];
// if (t1 == siz[v]) continue;
++t1;
// cout << "u = " << u << ", v = " << v << "\n";
// cout << rk[u][t] << ", " << t1 << "\n";
// cout << id[u][rk[u][t]] << ", " << id[v][t1] << "\n";
G[id[u][rk[u][t]]].eb(id[v][t1], w);
}
vv<ll> dis(cnt + 2, INF);
dis[id[1][1]] = 0;
ll stp = 0;
vv<queue<ll>> q(n + 2);
q[0].push(id[1][1]);
while (stp < n) {
while (!q[stp].empty()) {
ll x = q[stp].front(); q[stp].pop();
// cout << "x = " << x << ", stp = " << stp << "\n";
if (stp > dis[x]) continue;
for (auto [y, w] : G[x]) if (dis[y] > dis[x] + w) {
dis[y] = dis[x] + w, q[dis[y]].push(y);
}
}
++stp;
}
ll res = dis[id[n][siz[n]]];
cout << (res == INF ? -1 : res) << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
1 4 3 2 1 1 2 3 2 4 3 3
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
2 4 3 2 1 1 2 3 2 4 3 2 8 9 1 2 5 2 3 10 4 3 15 4 5 20 5 8 25 1 6 2 6 5 30 7 6 3 8 7 4
output:
-1 1
result:
ok 2 number(s): "-1 1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
8 2 1 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 2 1000000000 2 1 2 1 1000000000 2 1 1 1 1000000000 2 1 2 2 1000000000
output:
0 1 -1 -1 0 1 -1 -1
result:
ok 8 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
1 2 1 1 2 1
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 5ms
memory: 3512kb
input:
1000 10 10 1 2 1 2 4 1 6 1 1 3 8 1 7 2 1 3 2 1 1 4 1 2 6 1 9 4 1 10 7 1 10 10 4 7 1 10 2 1 8 2 1 9 1 1 1 9 1 4 4 1 10 2 1 4 7 1 8 2 1 9 9 1 10 10 7 5 1 2 2 1 8 7 1 10 9 1 2 7 1 4 6 1 4 1 1 1 2 1 3 8 1 2 1 1 10 10 6 10 1 4 7 1 10 9 1 4 8 1 1 1 1 1 1 1 1 7 1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ory: 3856kb
input:
1000 10 10 7 10 3 5 5 1 4 9 2 3 4 2 1 4 3 9 6 3 10 1 2 5 10 1 10 8 1 1 7 1 10 10 10 1 1 4 7 3 10 7 2 10 10 2 3 10 1 5 10 2 6 2 3 2 1 3 5 1 1 1 6 2 10 10 6 2 2 7 3 3 5 5 3 5 6 2 6 5 1 7 10 3 9 9 1 5 6 3 4 9 3 4 1 1 10 10 6 4 1 9 7 1 6 7 3 7 10 3 8 8 2 3 1 1 6 7 1 10 3 2 1 2 1 8 1 1 10 10 2 9 2 8 3 3 ...
output:
0 1 -1 2 -1 -1 1 0 0 -1 1 -1 0 -1 1 -1 -1 -1 -1 1 -1 -1 -1 2 -1 -1 -1 -1 -1 1 1 2 -1 1 -1 -1 2 1 -1 -1 -1 1 -1 1 -1 -1 -1 0 -1 -1 -1 -1 0 -1 0 1 1 -1 1 -1 -1 1 2 -1 -1 1 -1 -1 0 -1 0 -1 0 -1 -1 -1 -1 1 -1 0 -1 0 -1 1 0 0 -1 -1 -1 -1 -1 1 1 -1 2 -1 -1 0 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 0 -1 1 -1 0 -1 0 -...
result:
ok 1000 numbers
Test #8:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
1000 10 10 1 7 1 9 7 4 10 8 4 8 1 10 7 8 6 1 6 8 10 9 10 4 4 8 3 6 8 1 2 10 10 10 5 9 5 3 7 7 4 6 3 1 7 4 2 7 10 6 4 2 7 6 4 8 3 3 2 10 1 7 8 2 10 10 7 8 3 7 8 5 4 9 7 4 2 6 5 10 4 4 6 3 4 1 4 4 10 4 2 7 4 9 2 1 10 10 4 6 8 8 10 2 5 6 8 5 7 9 5 10 6 6 7 5 7 9 2 8 7 10 10 10 5 10 9 10 10 10 9 9 10 1 ...
output:
2 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 1 2 -1 0 -1 -1 -1 -1 0 2 -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 0 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 0 2 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 ...
result:
ok 1000 numbers
Test #9:
score: 0
Accepted
time: 6ms
memory: 3548kb
input:
1000 10 10 5 3 21 1 6 60 3 10 31 7 9 51 10 7 64 5 6 85 3 4 85 5 1 7 5 3 52 1 7 17 10 10 1 1 90 2 9 78 9 2 82 9 9 29 2 7 67 8 8 44 7 9 87 8 3 3 9 5 32 5 8 15 10 10 2 8 22 3 2 97 7 7 34 1 6 43 5 9 24 4 7 35 3 3 48 9 4 33 5 10 93 1 7 65 10 10 5 4 85 5 1 40 8 9 48 7 1 57 10 10 69 2 2 69 6 4 14 8 4 43 10...
output:
1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 1 0 -1 -1 -1 -1 2 0 0 -1 1 -1 -1 -1 0 -1 3 -1 -1 1 0 -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 0 -1 -1 -1 -1 -1 1 0 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 0 -1 2 0 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 ...
result:
ok 1000 numbers
Test #10:
score: 0
Accepted
time: 3ms
memory: 3856kb
input:
1000 10 10 10 10 268155137 5 10 540061009 1 10 110627680 1 4 533692575 3 5 10438095 6 7 730490278 6 2 985939776 8 10 500039201 1 9 185735931 4 2 729538420 10 10 8 1 326383784 5 3 726281100 4 6 279162422 4 4 243297959 1 2 984988531 3 10 856724546 2 4 627158366 4 5 880246199 9 1 675003875 7 7 76366643...
output:
0 -1 -1 -1 -1 0 -1 2 1 -1 2 -1 -1 -1 -1 1 -1 1 -1 0 -1 2 1 2 -1 -1 0 -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 0 -1 -1 -1 -1 -1 1 1 1 -1 0 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 0 -1 -1 -1 0 1 -1 2 -1 2 -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 0 -1...
result:
ok 1000 numbers
Test #11:
score: 0
Accepted
time: 6ms
memory: 3856kb
input:
1000 10 20 8 8 1 5 1 1 5 3 1 2 4 1 6 9 1 10 7 1 6 10 1 4 4 1 7 7 1 2 10 1 1 8 1 7 6 1 4 1 1 6 4 1 6 1 1 8 6 1 4 6 1 9 3 1 4 2 1 4 10 1 10 20 9 10 1 8 1 1 3 1 1 3 6 1 7 1 1 2 2 1 2 10 1 8 5 1 8 2 1 2 1 1 4 9 1 3 8 1 2 10 1 1 7 1 7 2 1 3 6 1 10 1 1 9 6 1 7 5 1 4 3 1 10 20 9 3 1 9 1 1 9 3 1 10 10 1 9 1...
output:
-1 1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 0 -1 -1 -1 -1 -1 -1 0 1 -1 -1 -1 -1 -1 0 1 -1 0 -1 -1 -1 -1 0 0 1 1 -1 1 -1 -1 -1 0 -1 0 -1 -1 -1 1 -1 -1 1 -1 -1 1 0 -1 -1 0 0 -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 0 1 1 0 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 0 -1 0 ...
result:
ok 1000 numbers
Test #12:
score: 0
Accepted
time: 8ms
memory: 3640kb
input:
1000 10 20 6 1 2 6 7 2 9 3 2 2 6 2 1 5 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-1 -1 2 2 0 1 -1 0 -1 -1 0 1 -1 1 -1 0 -1 -1 0 1 2 0 0 -1 1 -1 1 0 -1 -1 -1 -1 0 0 -1 -1 0 2 1 0 1 -1 -1 2 1 1 0 0 2 2 1 1 -1 0 0 0 1 0 -1 1 -1 1 0 0 -1 -1 -1 -1 1 -1 -1...
result:
ok 1000 numbers
Test #14:
score: 0
Accepted
time: 10ms
memory: 3636kb
input:
1000 10 20 4 4 7 8 2 9 9 8 2 4 4 7 9 4 8 4 2 10 2 1 8 3 5 10 8 8 8 5 7 9 5 3 2 4 9 7 5 3 2 1 6 5 3 1 10 4 7 4 9 3 4 4 7 7 5 8 8 8 10 1 10 20 6 1 10 8 2 10 4 5 2 6 4 10 1 6 8 8 9 8 6 7 10 8 2 9 1 3 4 6 4 1 5 1 3 4 8 4 1 7 7 5 3 7 1 9 2 9 2 5 5 6 3 2 5 8 1 4 10 3 9 5 10 20 2 7 6 4 8 3 6 4 9 1 4 10 10 ...
output:
-1 -1 1 -1 0 0 -1 -1 0 0 -1 0 0 1 1 2 -1 1 2 0 -1 -1 -1 0 1 -1 -1 -1 -1 -1 1 0 -1 1 0 0 0 1 0 -1 -1 0 0 -1 1 1 1 1 -1 -1 1 0 0 -1 -1 0 1 -1 1 1 1 1 0 1 1 0 1 1 -1 -1 2 -1 0 1 -1 0 2 -1 0 1 0 0 -1 -1 -1 1 1 -1 -1 0 -1 1 1 -1 -1 1 -1 2 1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 0 -1 0 -1 -1 0 -1 -1 3...
result:
ok 1000 numbers
Test #15:
score: 0
Accepted
time: 10ms
memory: 3856kb
input:
1000 10 20 2 4 98 7 8 21 7 1 36 6 1 61 4 2 77 1 3 60 5 4 6 6 6 9 4 4 7 7 10 76 4 6 49 6 3 44 3 10 23 9 4 12 7 5 15 2 1 7 3 3 83 4 7 79 8 1 93 10 6 96 10 20 5 5 31 3 8 37 8 8 59 1 8 33 1 9 94 7 7 73 1 9 24 10 3 97 9 5 36 3 1 73 6 3 46 4 2 83 4 4 98 7 7 96 5 10 60 5 2 76 5 2 61 6 4 29 1 10 99 6 3 92 1...
output:
1 0 -1 -1 0 0 -1 1 1 0 0 -1 1 0 0 0 0 1 0 1 -1 0 0 -1 -1 -1 -1 0 1 0 0 1 -1 0 1 -1 -1 1 1 1 2 1 0 -1 -1 0 1 1 1 1 -1 2 0 1 -1 1 1 0 -1 -1 0 -1 0 0 0 1 -1 1 -1 -1 -1 1 0 -1 2 1 -1 1 -1 -1 1 0 -1 1 0 0 -1 0 1 0 1 0 -1 0 0 0 0 1 0 -1 0 0 0 1 2 0 0 1 -1 1 2 0 0 1 -1 1 3 0 -1 0 0 1 0 0 -1 0 1 1 1 1 -1 -1...
result:
ok 1000 numbers
Test #16:
score: 0
Accepted
time: 7ms
memory: 3556kb
input:
1000 10 20 9 8 326353980 1 10 321178299 4 8 970616710 4 9 550923176 8 9 682488932 10 6 752852755 5 10 399703822 10 10 207683413 7 9 84451826 7 8 820433227 7 5 97884128 6 7 1405220 1 5 287655030 8 9 868446569 4 1 421832399 9 4 913601101 2 9 361785960 9 3 425625400 3 9 1891923 8 1 112588430 10 20 6 9 ...
output:
0 -1 0 1 -1 -1 -1 -1 0 -1 1 1 0 2 0 1 0 1 1 -1 -1 2 -1 0 0 1 -1 1 0 2 -1 1 1 1 1 0 0 -1 0 -1 0 0 1 1 1 0 2 -1 2 1 -1 0 0 -1 0 2 3 -1 -1 2 1 0 0 1 3 0 1 1 -1 -1 0 0 -1 1 0 1 1 1 1 0 1 0 1 1 3 0 -1 0 1 -1 -1 1 -1 -1 0 1 1 1 0 -1 0 0 -1 0 1 1 2 1 0 1 0 0 0 0 0 0 -1 -1 -1 -1 -1 1 1 -1 -1 0 1 0 1 -1 2 1 ...
result:
ok 1000 numbers
Test #17:
score: 0
Accepted
time: 12ms
memory: 3780kb
input:
1000 10 50 10 1 1 1 5 1 4 1 1 2 7 1 8 4 1 2 10 1 1 4 1 1 10 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 9 3 4 7 10 8 5 1 2 10 9 9 7 4 10 5 10 1 8 10 1 6 7 10 8 10 4 10 9 5 2 10 4 9 8 8 5 3 1 7 6 10 5 4 8 1 6 8 6 6 2 7 5 6 5 ...
output:
1 0 0 0 1 0 0 0 0 0 1 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 1 0 0 1 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 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 ...
result:
ok 1000 numbers
Test #21:
score: 0
Accepted
time: 26ms
memory: 3652kb
input:
1000 10 50 6 5 76 2 8 63 7 8 83 4 9 100 7 3 28 7 7 60 10 7 8 10 1 49 8 4 16 3 5 51 6 9 84 6 1 43 7 7 36 9 4 97 7 2 39 4 10 41 3 6 68 4 3 1 7 8 53 4 2 74 8 5 5 3 7 63 3 5 38 6 7 25 5 9 83 7 3 85 1 5 72 5 2 15 5 1 51 7 8 56 7 5 13 1 7 98 1 1 17 3 3 26 3 3 19 1 9 10 5 4 17 10 10 56 3 1 90 1 10 42 3 1 2...
output:
0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 1000 numbers
Test #22:
score: 0
Accepted
time: 27ms
memory: 3620kb
input:
1000 10 50 2 2 954153759 1 3 283444488 8 10 897162377 6 2 701352810 5 8 872948443 6 10 320895294 10 9 697730752 5 4 375661090 3 4 673334850 6 9 215515206 10 7 977251708 6 1 888046403 5 2 292147356 9 9 840382008 3 10 430429980 6 8 921004331 4 10 298467905 7 1 160104863 10 3 444341972 10 4 653051505 9...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 2 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 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 1 ...
result:
ok 1000 numbers
Test #23:
score: 0
Accepted
time: 63ms
memory: 3840kb
input:
1000 10 500 9 9 1 5 1 1 3 3 1 1 1 1 2 1 1 6 10 1 4 6 1 2 4 1 3 7 1 8 5 1 8 4 1 7 10 1 6 2 1 3 5 1 8 9 1 5 3 1 5 1 1 4 2 1 10 8 1 3 8 1 6 3 1 5 2 1 5 3 1 6 3 1 4 6 1 8 1 1 6 8 1 10 7 1 1 5 1 9 2 1 6 10 1 8 6 1 8 10 1 3 10 1 3 2 1 1 3 1 2 8 1 9 3 1 8 8 1 8 1 1 3 2 1 10 8 1 1 1 1 1 7 1 4 7 1 8 3 1 6 10...
output:
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 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 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 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 1000 numbers
Test #24:
score: 0
Accepted
time: 79ms
memory: 3668kb
input:
1000 10 500 5 7 1 6 2 1 7 3 1 4 7 1 5 9 1 7 4 1 7 6 2 4 10 2 7 4 1 9 3 2 9 5 1 1 9 1 9 4 2 6 7 1 2 3 2 7 7 2 2 4 2 8 8 2 10 8 2 9 7 2 8 10 2 4 4 2 2 7 2 8 7 2 4 6 2 7 9 2 6 8 1 4 3 2 6 1 2 6 2 2 3 5 2 3 10 2 8 2 2 5 9 2 3 6 1 9 10 2 3 5 2 10 1 2 4 10 2 8 8 2 10 4 1 4 5 1 4 9 1 6 1 1 1 7 2 7 1 2 9 5 ...
output:
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 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 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 ...
result:
ok 1000 numbers
Test #25:
score: 0
Accepted
time: 89ms
memory: 3612kb
input:
1000 10 500 5 8 1 5 9 1 10 1 2 5 3 3 1 10 3 10 2 3 4 7 3 4 5 2 2 6 3 6 5 2 8 1 2 3 6 3 7 6 3 2 1 2 1 1 2 9 3 3 10 1 2 2 4 2 6 5 1 10 6 3 5 10 3 2 9 2 2 5 2 7 10 2 1 10 1 8 9 3 9 8 3 2 5 3 7 5 1 1 7 3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 0 0 0 0 ...
result:
ok 1000 numbers
Test #27:
score: 0
Accepted
time: 242ms
memory: 3684kb
input:
1000 10 500 4 6 30 2 6 44 4 4 52 5 3 43 7 4 18 1 9 46 3 7 9 3 6 83 9 6 58 3 6 58 9 8 100 10 7 62 3 5 64 5 5 53 6 8 95 1 6 12 1 1 72 10 9 93 4 2 82 8 8 73 4 8 32 9 3 92 5 2 75 4 1 92 10 2 83 10 3 57 9 10 13 3 7 37 6 1 100 9 3 12 7 3 67 6 6 14 4 8 86 8 2 4 4 3 8 7 6 15 10 8 56 6 8 98 4 5 30 7 7 36 1 6...
output:
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 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 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 ...
result:
ok 1000 numbers
Test #28:
score: 0
Accepted
time: 289ms
memory: 3728kb
input:
1000 10 500 8 9 67526824 5 4 559064935 10 5 4911091 10 1 665435421 10 9 676899734 7 1 937378183 8 5 573246092 4 7 989380774 4 6 200810178 7 1 416005093 8 8 742684190 1 10 268750539 2 5 718281171 1 8 934536165 1 5 814664163 2 7 237449715 2 1 203051765 6 7 306356562 10 3 428234841 3 1 760994730 10 2 7...
output:
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 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 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 ...
result:
ok 1000 numbers
Test #29:
score: 0
Accepted
time: 212ms
memory: 3836kb
input:
1000 500 500 363 349 1 362 206 1 163 390 1 137 172 1 302 114 1 71 291 1 174 386 1 290 118 1 455 251 1 221 39 1 349 64 1 496 62 1 385 170 1 391 24 1 266 372 1 86 223 1 3 209 1 336 410 1 408 288 1 19 470 1 110 356 1 66 95 1 156 271 1 220 405 1 348 367 1 188 485 1 1 499 1 148 160 1 273 394 1 227 401 1 ...
output:
-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 -1 -1 -1 -1 -1 -...
result:
ok 1000 numbers
Test #30:
score: 0
Accepted
time: 259ms
memory: 3912kb
input:
1000 500 500 268 243 2 164 390 1 155 185 1 45 113 1 214 25 1 469 95 2 263 38 1 59 179 2 353 494 2 203 171 1 240 167 2 135 496 1 252 77 2 35 403 1 86 257 1 38 370 1 341 328 1 226 268 1 284 321 1 143 8 1 317 179 2 120 124 1 265 78 2 447 80 2 336 14 1 154 249 1 227 90 2 137 390 1 227 186 1 345 108 1 26...
output:
-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 -1 -1 -1 -1 -1 ...
result:
ok 1000 numbers
Test #31:
score: 0
Accepted
time: 277ms
memory: 3920kb
input:
1000 500 500 421 241 2 100 61 2 388 163 1 422 52 1 488 175 2 272 57 1 392 97 2 265 460 2 140 292 3 29 58 1 364 328 3 139 231 3 354 453 1 45 484 1 197 423 1 9 257 2 275 359 2 22 160 1 279 54 1 197 206 3 268 384 2 85 308 1 372 164 2 340 282 1 348 130 2 67 448 2 66 452 2 79 418 3 332 388 3 217 369 2 12...
output:
-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 -1 -1 -1 -1 -1 ...
result:
ok 1000 numbers
Test #32:
score: 0
Accepted
time: 272ms
memory: 3908kb
input:
1000 500 500 143 491 2 362 354 3 485 14 4 325 343 1 209 342 1 192 472 3 295 6 1 178 387 4 246 328 1 131 314 1 81 453 2 405 283 3 351 348 1 178 256 4 463 405 4 181 32 2 408 249 3 488 292 4 4 288 1 48 206 2 215 17 1 14 464 3 463 135 4 10 40 4 78 357 4 234 367 4 467 455 4 357 355 2 424 214 2 88 353 2 3...
output:
-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 -1 -1 -1 -1 -1 -1...
result:
ok 1000 numbers
Test #33:
score: 0
Accepted
time: 272ms
memory: 3984kb
input:
1000 500 500 140 313 3 155 280 5 197 292 4 234 230 2 348 46 2 269 194 5 434 202 4 33 311 3 152 335 1 384 145 3 235 127 4 370 147 2 444 328 1 127 2 3 357 189 4 255 141 5 460 386 2 398 138 5 326 417 3 51 108 1 22 33 4 251 390 2 79 74 1 215 245 1 482 366 1 253 449 1 460 25 4 318 157 4 380 336 2 225 356...
output:
-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 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
result:
ok 1000 numbers
Test #34:
score: 0
Accepted
time: 379ms
memory: 39448kb
input:
5 10000 100000 16 3559 468695643 7133 1854 827377604 2253 8986 212718926 3378 8735 205907497 3784 3272 98819139 5961 1839 898392689 4722 371 109250145 8884 4871 589883888 7498 9813 70864069 9475 6017 175126069 2932 4557 863780576 7285 6064 122334857 5448 5260 360605203 2995 6162 705458859 9806 2832 ...
output:
1 0 2 0 0
result:
ok 5 number(s): "1 0 2 0 0"
Test #35:
score: 0
Accepted
time: 383ms
memory: 39432kb
input:
5 10000 100000 400 1662 499032381 6939 2059 486853387 8062 4311 263485029 6906 9144 898349721 1374 9791 287537913 1401 2514 179426639 3206 356 654913984 955 4491 102066327 3824 2238 428099250 5030 4171 796495242 3176 8123 228296196 1660 5633 794625946 4996 4363 891788658 4221 4267 717537153 5092 647...
output:
1 0 2 1 1
result:
ok 5 number(s): "1 0 2 1 1"
Test #36:
score: 0
Accepted
time: 381ms
memory: 39140kb
input:
5 10000 100000 9526 8284 30390295 2776 8832 185094918 939 7505 922941741 5631 7025 869203187 8618 8178 304297509 4573 6637 697002478 7831 8738 160865264 8640 1154 975091136 3872 1182 637499754 9369 8403 47264467 6368 2555 483838225 7177 4894 244976652 9845 1265 564379654 2955 1436 118973925 3645 199...
output:
0 1 1 0 1
result:
ok 5 number(s): "0 1 1 0 1"
Test #37:
score: 0
Accepted
time: 512ms
memory: 217604kb
input:
1 100000 500000 34635 46033 243840177 89991 69694 442882506 19968 21610 887963959 59100 4326 518891263 32030 66602 905457084 6365 4377 378500516 35716 52072 375354442 83763 63671 748057938 90167 71718 314322061 20985 57673 399305781 33422 9344 54429249 8621 10927 88073233 24414 18967 895092185 91512...
output:
-1
result:
ok 1 number(s): "-1"
Test #38:
score: 0
Accepted
time: 508ms
memory: 218308kb
input:
1 100000 500000 15188 94877 126956305 36064 18948 613736176 54124 38302 322768646 61948 64766 801195445 69649 93035 698032982 45412 52100 455948433 23657 16312 543752460 82338 71180 928014228 84388 81926 336635918 20855 4689 124954834 75713 19615 821948475 70517 69931 455049369 11652 49042 460926915...
output:
-1
result:
ok 1 number(s): "-1"
Test #39:
score: 0
Accepted
time: 523ms
memory: 217576kb
input:
1 100000 500000 52638 76426 305039729 14841 68201 344398357 20983 22290 197764822 54396 25205 378466923 96868 95277 340865776 25674 24014 678620542 87405 89065 712150478 24017 78689 548162006 45905 24838 63982479 20726 94809 705379695 85300 72989 734691893 73629 72040 116992802 66185 79117 26761645 ...
output:
-1
result:
ok 1 number(s): "-1"
Test #40:
score: -100
Memory Limit Exceeded
input:
1 500000 500000 59280 54906 439822256 429265 418258 621212182 218147 211795 205467984 164946 71245 957403153 481375 344334 382889209 206719 295309 525844696 195710 220464 534488515 49094 402808 390137503 110467 267533 689219374 466476 328515 301654731 60840 13684 148387915 395867 144861 350257604 45...
output:
-1