QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#668285 | #7678. The Game | i0stream | WA | 46ms | 6488kb | C++14 | 1.1kb | 2024-10-23 13:20:07 | 2024-10-23 13:20:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3*1e5+100;
int n,m,t,T,succ,a[N],b[N],c[N];
ll p,s;
priority_queue<int,vector<int>,greater<int> > q1,q2;
int main(){
scanf("%d",&T);
while (T--){
scanf("%d%d",&n,&m);
t=0;p=0;s=0;
while (!q1.empty()) q1.pop();
while (!q2.empty()) q2.pop();
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
q1.push(a[i]);
if (i>=n-m+1) q2.push(a[i]),s+=a[i];
}
for (int i=1;i<=m;i++){
scanf("%d",&b[i]);
p+=b[i];
}
while (q1.size()-m > p-s){
c[++t]=q1.top();q1.pop();
q1.push(c[t]+1);q1.pop();
if (c[t]+1>q2.top()){
s+=c[t]+1-q2.top();
q2.pop();
q2.push(c[t]+1);
}
}
if (q1.size()-m == p-s){
for (int i=1;i<=m;i++){
a[i]=q2.top();
q2.pop();
}
succ=1;
for (int i=1;i<=m;i++){
if (a[i]>b[i]) succ=0;
while (a[i]<b[i]) c[++t]=a[i]++;
}
if (succ){
printf("%d\n",n-m);
for (int i=1;i<=t;i++) printf("%d ",c[i]);
puts("");
}else puts("-1");
}else puts("-1");
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 5896kb
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: 4ms
memory: 5920kb
input:
7056 4 3 1 1 1 1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 1 1 1 1 1 2 6 7 1 1 1 1 1 1 ...
output:
-1 -1 6 1 1 1 1 2 2 6 1 1 1 1 2 3 6 1 1 1 2 3 4 6 1 1 2 3 4 5 6 1 2 3 4 5 6 -1 -1 -1 -1 6 1 1 1 2 2 3 6 1 1 1 2 3 4 6 1 1 2 3 4 5 6 1 2 3 4 5 6 6 2 3 4 5 6 7 -1 -1 -1 6 1 1 1 2 2 3 6 1 1 1 2 3 4 6 1 1 1 3 4 5 6 1 1 3 4 5 6 6 1 3 4 5 6 7 -1 -1 -1 6 1 1 1 2 2 3 6 1 1 1 2 2 4 6 1 1 1 2...
result:
ok ok (27456 test cases)
Test #20:
score: 0
Accepted
time: 23ms
memory: 3788kb
input:
34650 8 4 1 1 1 1 1 1 1 1 1 1 1 1 8 4 1 1 1 1 1 1 1 1 1 1 1 2 8 4 1 1 1 1 1 1 1 1 1 1 1 3 8 4 1 1 1 1 1 1 1 1 1 1 1 4 8 4 1 1 1 1 1 1 1 1 1 1 1 5 8 4 1 1 1 1 1 1 1 1 1 1 2 2 8 4 1 1 1 1 1 1 1 1 1 1 2 3 8 4 1 1 1 1 1 1 1 1 1 1 2 4 8 4 1 1 1 1 1 1 1 1 1 1 2 5 8 4 1 1 1 1 1 1 1 1 1 1 3 3 8 4 1 1 1 1 1 ...
output:
-1 -1 -1 -1 4 1 2 3 4 -1 -1 4 1 1 2 3 -1 4 1 2 1 2 -1 -1 -1 -1 -1 -1 4 1 1 1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 1 2 3 4 -1 4 1 2 2 3 -...
result:
ok ok (34650 test cases)
Test #21:
score: 0
Accepted
time: 9ms
memory: 5828kb
input:
17325 8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-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 #26:
score: 0
Accepted
time: 29ms
memory: 5856kb
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: 39ms
memory: 3752kb
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: 35ms
memory: 5652kb
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: 46ms
memory: 6488kb
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: 30ms
memory: 4352kb
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: 24ms
memory: 5724kb
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: -100
Wrong Answer
time: 31ms
memory: 3756kb
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:
-1 -1 -1 -1 4 1 2 2 2 -1 -1 -1 4 1 2 2 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 2 2 2 2 -1 -1 -1 -1 -1 -1 -1 4 1 1 2 2 4 1 2 1 2 -1 4 1 1 2 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 4 1 1 2 2 4 1 2 2 2 -1 4 1 1 1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
wrong answer Jury has answer but participant has not (test case 1)