QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601605 | #7678. The Game | PonyHex | RE | 49ms | 9252kb | C++20 | 2.9kb | 2024-09-30 08:58:15 | 2024-09-30 08:58:15 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define ll long long
#define double long double
#define lc u<<1
#define rc u<<1|1
#define X first
#define Y second
#define endl "\n"
//#define int long long
const int N = 2e5 + 50;
const int M = 2e5 + 5;
const ll maxm = 1e18 + 5;
const ll mod = 998244353;
int dx[] = { -1,0,1,0 };
int dy[] = { 0,1,0,-1 };
//random_shuffle(id + 1, id + n + 1);
ll ksm(ll a, ll b);
ll gcd(ll a, ll b);
template<class T>inline void read(T& x) {
x = 0;
char c = getchar();
while (!isdigit(c))c = getchar();
while (isdigit(c))x = x * 10 + (c & 15), c = getchar();
}
void write(ll x)
{
if (x < 0)
putchar('-'), x = -x;
if (x > 9)
write(x / 10);
putchar(x % 10 + '0');
return;
}
ll a[N], b[N];
ll c[N];
void solve()
{
//这道赛时就出了,还有印象,我们发现应该优先利用较小的元素
//如果能执行前置操作,那么我们就一直执行前置操作
ll aa, bb; cin >> aa >> bb;
for (int i = 1; i <= aa; i++)read(a[i]);
for (int i = 1; i <= bb; i++)read(b[i]);
if (bb > aa) {
write(-1);
puts(""); return;
}
sort(a + 1, a + 1 + aa);
sort(b + 1, b + 1 + bb);
ll bdis = 0;
for (int i = 0; i < bb; i++) {
if (b[bb - i] < a[aa - i]) {
write(-1);
puts(""); return;
}
bdis += b[bb - i] - a[aa - i];
}
ll sumdis = aa - bb;
if (sumdis < bdis) {
write(-1);
puts(""); return;
}
vector<ll>ans;
priority_queue<ll, vector<ll>, greater<ll> >bq;
priority_queue<ll, vector<ll>, greater<ll> >fq;
for (int i = 1; i <= aa; i++) {
if (i <= aa - bb) {
fq.push(a[i]);
}
else {
bq.push(a[i]);
}
}
while (sumdis > bdis) {
if (fq.empty()) {
write(-1);
puts(""); return;
}
ll val = fq.top();
fq.pop();
ans.push_back(val); val++;
if (val > bq.top()) {
fq.push(bq.top());
bq.pop();
bq.push(val);
bdis--;
fq.pop();
}
else {
fq.push(val);
fq.pop();
}
sumdis--;
}
ll idx = 0;
while (bq.size()) {
c[++idx] = bq.top();
bq.pop();
}
ll cnt = 0;
for (int i = bb; i >= 1; i--) {
if (c[i] > b[i]) {
write(-1);
puts(""); return;
}
for (int j = c[i]; j < b[i]; j++) {
ans.push_back(j); cnt++;
}
}
if (cnt != fq.size()) {
write(-1);
puts(""); return;
}
write(ans.size());
puts("");
for (int i = 0; i < ans.size(); i++) {
write(ans[i]);
putchar(' ');
}
puts("");
return;
}
signed main()
{
/*
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);*/
int T = 1;
//cin >> T;
read(T);
while (T--)
solve();
return 0;
}
/*PonyHex*/
ll ksm(ll a, ll b) {
ll base = a;
ll ans = 1;
while (b) {
if (b & 1)ans *= base % mod;
ans %= mod;
base *= base; base %= mod;
b >>= 1;
}
return ans % mod;
}
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 7936kb
input:
6 5 3 1 2 2 3 3 2 3 4 4 2 1 2 2 4 2 4 5 2 2 3 3 4 4 5 5 6 1 1 1 1 1 1 1 4 4 2 1 1 1 2 2 2 4 1 1 1 1 1 2
output:
2 1 3 -1 3 2 4 4 5 1 1 1 2 3 2 1 1 -1
result:
ok ok (6 test cases)
Test #2:
score: 0
Accepted
time: 3ms
memory: 5592kb
input:
7056 4 3 1 1 1 1 1 1 1 4 3 1 1 1 1 1 1 2 4 3 1 1 1 1 1 1 3 4 3 1 1 1 1 1 1 4 4 3 1 1 1 1 1 1 5 4 3 1 1 1 1 1 1 6 4 3 1 1 1 1 1 2 2 4 3 1 1 1 1 1 2 3 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 ...
output:
-1 -1 2 1 2 -1 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 ok (41580 test cases)
Test #17:
score: 0
Accepted
time: 7ms
memory: 7700kb
input:
11550 7 3 1 1 1 1 1 1 1 1 1 1 7 3 1 1 1 1 1 1 1 1 1 2 7 3 1 1 1 1 1 1 1 1 1 3 7 3 1 1 1 1 1 1 1 1 1 4 7 3 1 1 1 1 1 1 1 1 1 5 7 3 1 1 1 1 1 1 1 1 2 2 7 3 1 1 1 1 1 1 1 1 2 3 7 3 1 1 1 1 1 1 1 1 2 4 7 3 1 1 1 1 1 1 1 1 2 5 7 3 1 1 1 1 1 1 1 1 3 3 7 3 1 1 1 1 1 1 1 1 3 4 7 3 1 1 1 1 1 1 1 1 3 5 7 3 1 ...
output:
-1 -1 -1 -1 4 1 2 3 4 -1 -1 4 1 2 3 1 -1 4 1 2 1 2 -1 -1 -1 -1 -1 4 1 1 1 1 4 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 -1 -1 -1 -1 -1 4 2 3 4 1 -1 4 2 3 1 2 -1 -1 -1 -1 -1 4 1 1 1 2 4 2 3 1 1 -1 4 2 1 2 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
result:
ok ok (11550 test cases)
Test #18:
score: 0
Accepted
time: 8ms
memory: 7668kb
input:
16632 7 2 1 1 1 1 1 1 1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26:
score: 0
Accepted
time: 12ms
memory: 7860kb
input:
6000 50 20 3 1 9 1 4 5 5 7 6 5 1 5 9 10 5 3 7 7 7 5 8 2 8 9 4 1 9 5 10 7 9 3 3 2 1 4 5 6 4 4 9 10 5 6 7 6 4 3 7 1 3 5 10 9 4 9 4 10 7 6 3 8 8 1 8 3 8 5 5 4 50 20 5 8 3 8 6 5 4 9 1 2 8 7 9 9 2 4 3 10 10 5 1 3 8 6 8 9 7 7 2 3 8 1 4 2 10 8 4 2 6 10 6 4 8 9 9 9 3 4 6 10 3 7 5 8 4 5 1 1 10 5 4 8 9 4 10 7...
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 ok (6000 test cases)
Test #27:
score: 0
Accepted
time: 8ms
memory: 7600kb
input:
3000 100 50 17 14 4 19 12 10 20 20 8 2 20 2 20 6 9 16 18 13 5 9 19 14 10 12 15 5 4 5 10 11 6 9 20 5 5 13 18 9 9 3 15 3 14 16 8 2 8 20 12 13 7 14 1 2 12 17 13 14 6 12 10 7 18 7 2 5 8 20 19 14 12 3 12 5 13 14 3 10 9 13 9 4 7 11 13 7 16 3 1 8 11 16 11 4 9 2 14 12 17 7 10 2 1 15 16 3 11 4 15 3 1 14 12 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 ok (3000 test cases)
Test #28:
score: 0
Accepted
time: 14ms
memory: 5896kb
input:
1500 200 100 3 2 6 6 3 4 10 5 10 10 2 10 4 8 1 3 4 1 2 1 2 9 10 6 9 4 2 3 1 6 4 1 6 5 7 1 3 7 3 9 8 1 5 5 8 6 8 4 4 2 5 5 2 4 4 1 2 5 2 10 9 2 9 9 4 10 3 10 10 6 9 3 1 1 3 8 8 10 8 4 1 6 10 4 8 5 2 2 10 3 3 6 5 7 8 5 1 9 10 3 9 4 5 5 2 2 3 9 4 1 1 5 9 1 8 4 9 4 9 3 7 10 7 3 9 6 2 4 5 2 10 5 1 2 4 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 ...
result:
ok ok (1500 test cases)
Test #29:
score: 0
Accepted
time: 17ms
memory: 6440kb
input:
3 100000 98000 8 1 8 5 5 9 1 1 7 6 7 9 1 7 10 9 1 6 10 7 4 6 4 8 3 8 6 2 9 3 1 6 4 7 9 4 5 1 3 8 2 3 1 6 9 10 10 9 5 7 4 2 4 5 4 10 9 3 5 7 6 6 5 7 4 1 3 2 6 4 9 4 9 9 5 5 8 8 8 9 3 7 10 7 4 1 9 3 8 8 3 1 9 10 4 7 3 4 6 1 7 1 4 7 2 1 7 6 2 1 8 5 5 1 6 1 6 5 4 1 4 8 2 4 9 4 9 7 5 8 2 4 6 3 6 8 10 3 6...
output:
-1 -1 -1
result:
ok ok (3 test cases)
Test #30:
score: 0
Accepted
time: 23ms
memory: 6380kb
input:
3 100000 100 26628 15576 98990 43976 49647 68346 23924 26821 38507 73889 64208 7286 8583 43126 43052 76461 583 97495 60100 38769 3107 93747 71788 5884 62213 23247 35912 89245 73679 25668 84434 1943 8147 35006 4375 60512 7641 68542 90586 51747 18780 49625 38064 55647 67725 65368 51875 80357 97039 783...
output:
-1 -1 -1
result:
ok ok (3 test cases)
Test #31:
score: 0
Accepted
time: 7ms
memory: 5548kb
input:
6000 50 20 1 1 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 2 1 2 2 2 2 1 1 2 1 1 2 2 2 2 1 1 1 1 2 2 1 2 1 2 1 2 2 2 2 1 2 2 2 1 2 1 1 1 1 2 2 1 1 1 2 1 50 20 1 1 1 1 1 2 1 1 1 2 2 1 1 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 1 1 1 1 2 1 1 1 2 2 2 2 1 1 1 2 2 1 2 1 1 1 1 2 1 2 2 2 2 1 2 2 2 2 1 2 1 1 1 2 2 1 50 ...
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 ok (6000 test cases)
Test #32:
score: 0
Accepted
time: 42ms
memory: 7672kb
input:
30000 10 6 1 2 3 1 2 3 1 2 2 2 3 3 3 2 3 2 10 6 2 1 1 3 1 1 3 1 3 2 2 3 2 2 4 4 10 6 2 1 2 1 2 2 3 3 2 1 3 2 2 3 2 4 10 6 3 2 2 2 3 2 1 1 2 2 3 3 2 3 3 3 10 6 1 2 3 2 3 2 3 2 3 1 3 3 3 3 3 3 10 6 1 3 3 2 1 3 2 2 2 3 3 3 3 3 3 3 10 6 3 1 1 3 2 2 1 1 1 3 2 3 4 2 2 3 10 6 2 3 3 1 2 2 2 3 1 3 3 3 3 3 3 ...
output:
4 1 1 2 2 4 1 1 3 3 4 1 1 3 2 4 1 2 2 2 4 1 2 2 2 4 1 2 2 2 4 1 1 1 3 4 1 2 2 2 4 1 2 2 3 4 1 2 2 2 4 1 2 2 3 4 1 2 2 2 4 3 3 2 2 4 1 2 2 3 4 1 2 2 3 4 1 3 2 2 4 1 3 3 2 4 1 1 2 2 4 1 1 1 2 4 1 1 1 2 3 1 1 2 4 1 1 2 2 4 1 1 2 2 4 1 1 3 2 4 1 2 2 2 4 1 2 2 3 4 1 2 2 2 4 1 2...
result:
ok ok (30000 test cases)
Test #33:
score: 0
Accepted
time: 20ms
memory: 5656kb
input:
6000 50 30 4 9 2 8 2 4 10 3 7 8 6 2 5 9 2 5 10 5 2 6 10 2 9 3 1 7 1 9 4 1 5 4 9 6 10 4 1 2 3 8 8 4 10 1 3 5 5 7 1 4 10 7 10 9 5 5 6 8 10 8 5 10 5 6 7 5 6 9 6 9 5 5 8 8 9 8 5 10 9 5 50 30 5 4 1 10 6 5 9 9 4 8 10 4 9 9 3 1 1 5 1 2 5 5 3 8 2 10 3 9 10 5 2 2 5 9 3 1 10 8 4 8 5 4 10 5 1 5 10 10 2 3 5 10 ...
output:
20 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 7 5 20 1 1 1 2 2 2 2 3 3 3 3 3 4 4 4 9 9 8 5 5 20 1 1 1 2 2 2 3 3 3 4 4 4 8 7 7 6 6 5 5 5 19 1 1 2 2 2 2 2 3 3 3 3 3 10 9 7 6 5 4 4 20 1 1 1 2 2 2 3 3 3 3 3 4 10 9 8 7 5 5 5 5 20 1 1 2 2 2 2 3 3 3 3 4 4 4 10 9 8 8 6 5 5 20 1 1 2 2 3 3 3 3 4 4 4 4 5 5 5 10...
result:
ok ok (6000 test cases)
Test #34:
score: 0
Accepted
time: 31ms
memory: 5556kb
input:
6000 50 30 2 13 7 12 12 8 3 9 3 4 3 14 8 12 3 14 6 2 6 13 10 4 4 1 1 2 10 4 14 4 9 1 1 13 10 6 11 4 12 8 6 13 3 4 14 7 14 5 4 7 13 6 15 14 6 12 6 6 8 9 10 12 14 12 13 11 9 15 6 7 13 7 13 12 9 10 14 8 14 8 50 30 15 2 9 6 13 3 10 8 4 9 6 13 1 12 1 2 13 15 7 3 3 7 15 14 9 10 11 6 3 15 5 10 4 13 3 4 4 1...
output:
20 1 1 2 2 2 3 3 3 3 4 4 14 14 13 12 11 10 8 7 5 20 1 1 2 2 3 3 3 15 14 14 13 13 13 10 9 7 7 7 6 6 20 1 1 1 2 2 3 14 14 13 11 10 9 9 8 8 8 8 7 6 6 20 1 1 1 2 2 3 3 4 4 15 15 13 12 10 9 9 8 6 6 6 20 1 1 1 2 2 3 3 4 4 5 5 5 5 6 6 13 7 7 7 7 20 1 1 2 2 3 3 3 3 4 4 15 12 11 11 11 9 8 7 7 7 20 1 1 ...
result:
ok ok (6000 test cases)
Test #35:
score: 0
Accepted
time: 24ms
memory: 7740kb
input:
6000 50 30 18 6 18 13 8 2 15 6 9 10 14 10 13 11 3 15 9 15 5 15 3 17 16 10 7 10 3 6 5 7 19 1 8 1 17 15 16 11 20 9 1 19 9 15 6 18 1 15 19 19 10 15 16 23 10 20 17 14 11 19 18 13 12 10 19 15 10 18 17 15 10 10 15 15 20 17 15 19 15 14 50 30 14 8 1 11 8 17 11 11 15 13 17 5 11 20 17 20 7 2 3 6 14 12 6 20 14...
output:
20 1 1 2 2 3 3 4 5 5 20 21 22 19 19 18 16 13 11 9 9 20 1 1 2 2 3 3 4 5 5 6 17 14 14 13 12 12 11 11 9 8 19 1 1 1 2 2 2 3 3 4 4 19 15 15 14 12 10 8 8 8 20 1 1 2 2 3 3 3 4 4 18 18 17 16 16 14 10 9 8 8 7 20 1 1 2 2 3 3 4 4 4 4 18 17 11 11 10 8 8 8 7 8 20 1 1 2 2 2 3 20 21 22 20 16 16 15 15 15 12 12...
result:
ok ok (6000 test cases)
Test #36:
score: 0
Accepted
time: 19ms
memory: 5564kb
input:
6000 50 30 3 15 14 18 15 19 21 8 19 2 4 12 16 20 18 25 14 22 7 4 15 17 1 2 7 17 12 13 4 25 24 7 5 16 18 24 20 2 6 11 5 7 8 6 17 25 7 10 17 6 12 25 10 14 17 18 17 12 19 15 18 17 12 21 22 24 25 18 13 21 18 19 22 16 16 25 16 25 20 14 50 30 14 24 25 2 12 23 1 8 19 20 17 14 4 19 24 2 18 22 7 4 17 18 9 10...
output:
20 1 2 2 3 4 4 5 5 24 21 20 20 19 18 17 17 16 15 15 11 20 1 2 2 3 3 4 24 24 23 22 22 20 21 19 20 19 18 18 17 12 20 1 1 2 2 3 3 3 4 4 5 5 24 21 20 18 17 17 16 15 13 20 1 2 2 3 23 22 21 17 16 16 15 16 13 13 12 13 12 12 10 10 20 1 2 2 3 4 6 25 26 25 26 25 24 22 20 19 19 17 17 14 11 19 1 2 2 3 4 4 ...
result:
ok ok (6000 test cases)
Test #37:
score: 0
Accepted
time: 33ms
memory: 7772kb
input:
300 1000 800 246 508 46 134 515 412 848 608 126 798 725 18 702 267 623 808 446 816 99 663 688 254 834 715 357 241 843 849 414 522 744 478 887 341 100 598 758 420 988 141 513 994 699 642 213 896 515 687 895 459 211 131 335 44 220 536 632 951 11 709 730 204 475 436 152 250 920 461 547 575 204 794 908 ...
output:
200 2 3 4 4 4 5 5 5 6 7 8 11 12 13 14 14 15 16 17 18 19 19 20 21 21 21 22 23 24 25 27 28 29 30 31 31 32 34 35 36 37 37 38 39 41 43 44 45 46 52 53 53 54 55 58 59 60 61 64 66 67 69 70 71 72 72 73 73 74 76 77 78 79 80 81 82 83 84 85 86 87 88 93 94 97 97 98 99 99 100 100 101 102 102 103 107 108 109 110 ...
result:
ok ok (300 test cases)
Test #38:
score: 0
Accepted
time: 37ms
memory: 7884kb
input:
300 1000 700 387 402 514 158 333 626 917 599 37 843 654 459 642 305 227 87 613 628 210 356 582 589 283 551 733 596 800 242 385 116 4 680 653 757 937 956 910 994 920 59 830 209 213 669 956 886 441 632 450 319 151 381 566 17 703 705 745 962 965 406 971 309 762 943 309 81 490 7 917 194 797 907 670 487 ...
output:
300 4 5 6 7 7 8 8 9 9 10 11 12 13 13 14 14 15 15 16 17 17 18 19 21 22 23 24 25 27 28 29 30 32 34 35 36 37 38 39 40 40 41 41 42 43 43 44 45 46 46 47 49 50 51 52 54 55 56 57 58 59 60 61 63 64 66 69 70 71 72 74 75 75 76 77 78 79 79 80 81 81 82 82 83 83 84 85 86 86 87 87 87 88 88 89 90 91 91 92 93 94 94...
result:
ok ok (300 test cases)
Test #39:
score: 0
Accepted
time: 39ms
memory: 7688kb
input:
300 1000 500 943 269 325 447 277 43 67 545 274 64 681 119 645 971 776 371 889 457 421 939 868 913 575 200 177 215 996 552 582 737 533 756 791 21 749 923 801 817 878 861 104 218 260 898 89 550 919 209 792 665 686 9 988 884 127 475 398 449 392 709 262 385 129 433 558 702 79 132 165 73 499 703 557 805 ...
output:
500 1 2 3 3 4 4 5 5 6 6 7 8 9 10 11 12 13 14 14 15 20 21 24 25 26 27 28 31 32 33 34 35 36 37 38 39 39 40 41 43 43 44 44 45 46 46 47 48 49 50 51 52 52 53 54 55 56 59 60 61 62 64 66 66 67 67 68 68 69 70 71 73 74 75 76 77 78 78 78 79 79 79 80 81 82 83 86 87 88 89 90 90 91 92 93 95 96 97 98 99 99 100 10...
result:
ok ok (300 test cases)
Test #40:
score: 0
Accepted
time: 49ms
memory: 7732kb
input:
300 1000 300 343 99 102 991 677 740 397 454 501 724 261 765 82 256 538 785 427 409 680 269 740 747 443 601 421 838 349 174 754 96 36 419 361 290 865 915 63 582 730 661 683 408 272 123 114 834 746 699 305 933 273 729 934 647 786 27 376 600 839 123 658 796 582 145 68 812 200 855 546 796 283 811 851 70...
output:
700 1 11 13 14 15 20 22 23 24 24 25 26 27 27 28 28 29 29 30 31 32 33 33 34 35 36 37 40 43 44 44 45 47 48 49 50 51 54 57 58 60 61 61 62 62 63 63 64 66 67 68 69 71 72 73 74 75 76 77 82 83 83 84 84 85 85 86 87 87 88 88 89 90 91 92 92 93 93 94 95 96 96 96 97 98 98 99 99 99 100 101 102 103 107 108 112 11...
result:
ok ok (300 test cases)
Test #41:
score: 0
Accepted
time: 46ms
memory: 5856kb
input:
300 1000 100 594 996 948 260 612 869 679 466 541 85 604 111 991 9 16 833 786 215 786 930 343 557 952 6 926 432 898 120 577 166 958 877 927 157 443 551 858 89 758 395 473 690 824 635 127 467 765 166 770 812 254 475 997 473 496 625 894 618 179 242 312 665 677 796 731 407 132 727 231 630 935 417 909 51...
output:
900 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 18 19 20 20 21 22 26 27 27 28 31 31 32 33 36 39 40 41 41 41 42 42 43 43 44 45 46 47 50 51 51 52 52 53 54 55 56 57 58 59 60 61 64 65 67 68 68 69 70 71 72 73 75 76 77 78 78 79 80 83 85 86 88 89 89 90 91 92 93 93 94 95 98 99 101 102 111 111 112 112 113...
result:
ok ok (300 test cases)
Test #42:
score: 0
Accepted
time: 36ms
memory: 8292kb
input:
3 100000 80021 33 74 99 100 44 49 33 41 61 15 26 74 26 79 43 74 99 42 25 64 81 18 75 77 14 34 89 44 55 52 87 97 6 47 100 93 8 97 83 44 56 62 34 44 42 91 50 43 9 1 56 89 45 79 39 15 70 92 80 65 96 66 25 54 93 43 82 14 45 48 87 27 9 57 16 49 27 19 63 64 4 27 81 46 95 68 17 9 12 44 92 30 78 99 84 97 10...
output:
19979 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 ok (3 test cases)
Test #43:
score: 0
Accepted
time: 43ms
memory: 8532kb
input:
3 100000 70031 67 88 52 29 20 47 14 24 55 21 21 67 1 19 68 85 9 85 48 14 9 70 59 42 19 74 97 24 74 99 38 81 67 96 89 41 52 33 4 54 44 85 85 41 16 43 22 14 67 81 22 32 76 32 58 31 7 42 86 12 4 15 37 100 36 33 48 9 73 71 84 40 7 54 43 86 1 79 23 23 28 94 87 18 45 91 8 7 1 59 69 3 96 35 79 100 24 46 94...
output:
29969 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 ok (3 test cases)
Test #44:
score: 0
Accepted
time: 37ms
memory: 8936kb
input:
3 100000 60040 6 9 13 59 88 49 98 23 61 18 13 60 68 63 89 96 19 35 83 56 34 30 32 12 21 9 1 93 5 46 81 69 23 37 62 77 91 69 24 68 23 100 28 33 86 6 86 89 10 58 81 62 2 89 81 50 56 5 88 70 16 56 58 43 79 14 19 92 98 2 77 50 96 54 67 19 87 50 75 83 56 70 89 99 78 21 2 96 99 74 50 72 27 75 74 6 55 64 6...
output:
39960 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 ok (3 test cases)
Test #45:
score: 0
Accepted
time: 28ms
memory: 9252kb
input:
3 100000 50038 44 23 69 88 65 43 70 13 55 12 9 62 44 6 10 14 25 86 7 9 58 87 17 82 22 49 21 73 32 89 32 53 83 86 47 21 19 5 52 81 18 14 83 30 60 73 51 68 68 26 39 93 33 46 96 61 97 68 97 20 25 92 79 86 23 95 77 91 14 29 74 52 90 54 98 60 57 18 32 51 75 41 3 75 27 47 93 90 93 97 23 54 50 14 66 8 82 8...
output:
49962 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 ok (3 test cases)
Test #46:
score: -100
Runtime Error
input:
1 300000 170000 709767392 991931703 440786157 420253632 70142923 541765687 58272546 934857792 30813956 431614551 455745309 196615204 410670889 331951123 899394213 949683236 794740169 16996863 148141492 243752523 547346921 684101439 41901818 592233592 31232642 849937933 205471831 209747680 804177152 ...