QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#699077#7678. The GamejiangzhihuiWA 21ms3892kbC++232.9kb2024-11-02 00:41:522024-11-02 00:41:52

Judging History

你现在查看的是最新测评结果

  • [2024-11-02 00:41:52]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:3892kb
  • [2024-11-02 00:41:52]
  • 提交

answer

#include<bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include<bits/Bingbong.h>
#endif
using namespace std;
#define i64 long long
#define pi acos(-1)
void solve(){
  int n,m;
  cin>>n>>m;
  vector<int>a(n+1),b(m+1);
  for(int i=1;i<=n;i++) cin>>a[i];
  for(int i=1;i<=m;i++) cin>>b[i];

  sort(a.begin()+1,a.begin()+n+1);
  sort(b.begin()+1,b.begin()+m+1);
  int l1=n,l2=m;
  i64 cz_val=0;
  while(l1>0&&l2>0){
    if(a[l1]>b[l2]){
      cout<<"-1\n";
      return ;
    }else{
      cz_val+=b[l2]-a[l1];
    }
    l1--;
    l2--;
  }
  vector<int>ans;
  if(cz_val<n-m){
    //case 1
    priority_queue<int,vector<int>,greater<int>>q;
    for(int i=1;i<=n;i++){
      q.push(a[i]);
    }
    //debug(q.size(),cz_val);
    while(q.size()-cz_val>m){
      auto t=q.top();
      q.pop();
      ans.push_back(t);
      t++;
      q.push(t);
      q.pop();
    }
    //debug(q.top(),q.size());
    if(q.top()>b[1]){
      cout<<"-1\n";
      return ;
    } 
    //小的处理好了,只需要把差值对应的加上去
    //把队列中元素搞成容器
    vector<int>ta(n+1);
    int k=0;
    while(!q.empty()){
      ta[++k]=q.top();
      q.pop();
    }
   // debug(k);

    if(k-cz_val!=m){
      cout<<"-1\n";
      return ;
    }
    int L1=k,L2=m;
    int newcz=0;
    while(L1>0&&L2>0){
      if(ta[L1]>b[L2]){
        cout<<"-1\n";
        return ;
      }else{
         newcz+=b[L2]-ta[L1];
      }
      L1--;
      L2--;
    }
    //debug(k,newcz);
    // 存在唯一情况,就是 那个小于的可以自己删掉
    if(k-newcz>m){
      //debug(k,newcz);
      // 看下最小的能不能删掉
      int tz=k-newcz-m;
      int ba=ta[tz+1];
      priority_queue<int,vector<int>,greater<int>>qq;
      for(int i=1;i<=tz;i++) qq.push(ta[i]);
      while(!qq.empty()){
        auto t=qq.top();
        if(t+1>b[1]){
          cout<<"-1\n";
          return ;
        }else{
          qq.pop();
          ans.push_back(t);
          t++;

          qq.push(t);
          qq.pop();
        }
      }
      
    }
    L1=k;
    L2=m;
    while(1){
      while(ta[L1]<b[L2]){
        ans.push_back(ta[L1]);
        ta[L1]++;
      }
      L1--;
      L2--;
      if(L2==0){
        break;
      }
    }

  }else if(cz_val==n-m){
    int l1=n,l2=m;
    while(1){
      while(a[l1]<b[l2]){
        ans.push_back(a[l1]);
        a[l1]++;
      }
      l1--;
      l2--;
      if(l2==0){
        break;
      }
    }
  }else{
    cout<<"-1\n";
    return ;
  }

  //

  cout<<ans.size()<<"\n";
  for(auto t:ans){
    cout<<t<<" ";
  }
  cout<<"\n";

}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    cin>>t;
    while(t--) {
      solve();
    }
    return 0;
}
/*
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

*/

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3888kb

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: 3656kb

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 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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
2
3 4 
-1
-1
-1
2
1 1 
2
3 1 
-1
-1
-1
2
1 2 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok ok (5880 test cases)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

2640
4 1
1 1 1 1
1
4 1
1 1 1 1
2
4 1
1 1 1 1
3
4 1
1 1 1 1
4
4 1
1 1 1 1
5
4 1
1 1 1 1
6
4 1
1 1 1 1
7
4 1
1 1 1 1
8
4 1
1 1 1 2
1
4 1
1 1 1 2
2
4 1
1 1 1 2
3
4 1
1 1 1 2
4
4 1
1 1 1 2
5
4 1
1 1 1 2
6
4 1
1 1 1 2
7
4 1
1 1 1 2
8
4 1
1 1 1 3
1
4 1
1 1 1 3
2
4 1
1 1 1 3
3
4 1
1 1 1 3
4
4 1
1 1 1 3
5
4...

output:

-1
-1
3
1 1 2 
3
1 2 3 
-1
-1
-1
-1
-1
-1
3
1 1 2 
3
1 2 3 
3
2 3 4 
-1
-1
-1
-1
-1
3
1 1 2 
3
1 1 3 
3
1 3 4 
3
3 4 5 
-1
-1
-1
-1
-1
3
1 1 2 
3
1 1 4 
3
1 4 5 
3
4 5 6 
-1
-1
-1
-1
-1
3
1 1 2 
3
1 1 5 
3
1 5 6 
3
5 6 7 
-1
-1
-1
-1
-1
3
1 1 2 
3
1 1 6 
3
1 6 7 
-1
-1
-1
-1
-1
-1
3
1 1 2 
3
1 1 7 
...

result:

ok ok (2640 test cases)

Test #5:

score: 0
Accepted
time: 6ms
memory: 3592kb

input:

14112
5 3
1 1 1 1 1
1 1 1
5 3
1 1 1 1 1
1 1 2
5 3
1 1 1 1 1
1 1 3
5 3
1 1 1 1 1
1 1 4
5 3
1 1 1 1 1
1 1 5
5 3
1 1 1 1 1
1 1 6
5 3
1 1 1 1 1
1 2 2
5 3
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1 
-1
3
1 1 2 
3
3 1 2 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3
1 1 4 
3
4...

result:

ok ok (5292 test cases)

Test #7:

score: 0
Accepted
time: 2ms
memory: 3856kb

input:

3234
5 1
1 1 1 1 1
1
5 1
1 1 1 1 1
2
5 1
1 1 1 1 1
3
5 1
1 1 1 1 1
4
5 1
1 1 1 1 1
5
5 1
1 1 1 1 1
6
5 1
1 1 1 1 1
7
5 1
1 1 1 1 2
1
5 1
1 1 1 1 2
2
5 1
1 1 1 1 2
3
5 1
1 1 1 1 2
4
5 1
1 1 1 1 2
5
5 1
1 1 1 1 2
6
5 1
1 1 1 1 2
7
5 1
1 1 1 1 3
1
5 1
1 1 1 1 3
2
5 1
1 1 1 1 3
3
5 1
1 1 1 1 3
4
5 1
1 1...

output:

-1
-1
4
1 1 1 2 
4
1 1 2 3 
4
1 2 3 4 
-1
-1
-1
-1
4
1 1 2 2 
4
1 1 2 3 
4
1 2 3 4 
4
2 3 4 5 
-1
-1
-1
-1
4
1 1 2 3 
4
1 1 3 4 
4
1 3 4 5 
4
3 4 5 6 
-1
-1
-1
4
1 1 2 3 
4
1 1 2 4 
4
1 1 4 5 
4
1 4 5 6 
-1
-1
-1
-1
4
1 1 2 3 
4
1 1 2 5 
4
1 1 5 6 
-1
-1
-1
-1
-1
4
1 1 2 3 
4
1 1 2 6 
-1
-1
-1
-1
-1...

result:

ok ok (3234 test cases)

Test #8:

score: 0
Accepted
time: 4ms
memory: 3664kb

input:

8820
5 4
1 1 1 1 1
1 1 1 1
5 4
1 1 1 1 1
1 1 1 2
5 4
1 1 1 1 1
1 1 1 3
5 4
1 1 1 1 1
1 1 1 4
5 4
1 1 1 1 1
1 1 1 5
5 4
1 1 1 1 1
1 1 2 2
5 4
1 1 1 1 1
1 1 2 3
5 4
1 1 1 1 1
1 1 2 4
5 4
1 1 1 1 1
1 1 2 5
5 4
1 1 1 1 1
1 1 3 3
5 4
1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-1
-1
-...

result:

ok ok (26460 test cases)

Test #10:

score: 0
Accepted
time: 15ms
memory: 3604kb

input:

50000
6 4
1 1 1 1 1 1
1 1 1 1
6 4
1 1 1 1 1 1
1 1 1 2
6 4
1 1 1 1 1 1
1 1 1 3
6 4
1 1 1 1 1 1
1 1 1 4
6 4
1 1 1 1 1 1
1 1 1 5
6 4
1 1 1 1 1 1
1 1 1 6
6 4
1 1 1 1 1 1
1 1 2 2
6 4
1 1 1 1 1 1
1 1 2 3
6 4
1 1 1 1 1 1
1 1 2 4
6 4
1 1 1 1 1 1
1 1 2 5
6 4
1 1 1 1 1 1
1 1 2 6
6 4
1 1 1 1 1 1
1 1 3 3
6 4
1 ...

output:

-1
-1
2
1 2 
-1
-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
-...

result:

ok ok (50000 test cases)

Test #11:

score: 0
Accepted
time: 12ms
memory: 3652kb

input:

25872
6 3
1 1 1 1 1 1
1 1 1
6 3
1 1 1 1 1 1
1 1 2
6 3
1 1 1 1 1 1
1 1 3
6 3
1 1 1 1 1 1
1 1 4
6 3
1 1 1 1 1 1
1 1 5
6 3
1 1 1 1 1 1
1 1 6
6 3
1 1 1 1 1 1
1 2 2
6 3
1 1 1 1 1 1
1 2 3
6 3
1 1 1 1 1 1
1 2 4
6 3
1 1 1 1 1 1
1 2 5
6 3
1 1 1 1 1 1
1 2 6
6 3
1 1 1 1 1 1
1 3 3
6 3
1 1 1 1 1 1
1 3 4
6 3
1 1 ...

output:

-1
-1
-1
3
1 2 3 
-1
-1
-1
3
1 2 1 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3
1 1 1 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3
2 3 4 
-1
-1
-1
3
2 3 1 
-1
-1
3
2 1 2 
-1
-1
-1
-1
-1
-1
-1
-1
-1
3
1 1 1 
3
2 1 1 
-1
-1
-1
-1
-1
...

result:

ok ok (25872 test cases)

Test #12:

score: 0
Accepted
time: 12ms
memory: 3820kb

input:

25872
6 2
1 1 1 1 1 1
1 1
6 2
1 1 1 1 1 1
1 2
6 2
1 1 1 1 1 1
1 3
6 2
1 1 1 1 1 1
1 4
6 2
1 1 1 1 1 1
1 5
6 2
1 1 1 1 1 1
1 6
6 2
1 1 1 1 1 1
1 7
6 2
1 1 1 1 1 1
2 2
6 2
1 1 1 1 1 1
2 3
6 2
1 1 1 1 1 1
2 4
6 2
1 1 1 1 1 1
2 5
6 2
1 1 1 1 1 1
2 6
6 2
1 1 1 1 1 1
2 7
6 2
1 1 1 1 1 1
3 3
6 2
1 1 1 1 1 ...

output:

-1
-1
-1
-1
4
1 2 3 4 
-1
-1
-1
4
1 1 2 1 
4
1 2 3 1 
-1
-1
-1
4
1 2 1 2 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
2 3 4 5 
-1
-1
4
1 1 1 2 
4
1 1 2 3 
4
2 3 4 1 
-1
-1
4
1 1 2 2 
4
2 3 1 2 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
3 4 5 6 
-1
-1
4
1 1 1 3 
4
1 1 ...

result:

ok ok (25872 test cases)

Test #13:

score: 0
Accepted
time: 7ms
memory: 3524kb

input:

13728
6 1
1 1 1 1 1 1
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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
-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 ok (10080 test cases)

Test #15:

score: 0
Accepted
time: 12ms
memory: 3692kb

input:

23100
7 4
1 1 1 1 1 1 1
1 1 1 1
7 4
1 1 1 1 1 1 1
1 1 1 2
7 4
1 1 1 1 1 1 1
1 1 1 3
7 4
1 1 1 1 1 1 1
1 1 1 4
7 4
1 1 1 1 1 1 1
1 1 1 5
7 4
1 1 1 1 1 1 1
1 1 2 2
7 4
1 1 1 1 1 1 1
1 1 2 3
7 4
1 1 1 1 1 1 1
1 1 2 4
7 4
1 1 1 1 1 1 1
1 1 2 5
7 4
1 1 1 1 1 1 1
1 1 3 3
7 4
1 1 1 1 1 1 1
1 1 3 4
7 4
1 1 ...

output:

-1
-1
-1
3
1 2 3 
-1
-1
3
1 2 1 
-1
-1
-1
-1
-1
-1
-1
-1
3
1 1 1 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3
2 3 4 
-1
-1
3
2 3 1 
-1
3
2 1 2 
-1
-1
-1
-1
-1
-1
3
2 1 ...

result:

ok ok (23100 test cases)

Test #16:

score: 0
Accepted
time: 21ms
memory: 3816kb

input:

41580
7 5
1 1 1 1 1 1 1
1 1 1 1 1
7 5
1 1 1 1 1 1 1
1 1 1 1 2
7 5
1 1 1 1 1 1 1
1 1 1 1 3
7 5
1 1 1 1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-1
-1
4
2 3 4 1 
-1
4
2 3 1 2 
-1
-1
-1
-1
-1
4
1 1 2 1 
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: -100
Wrong Answer
time: 8ms
memory: 3892kb

input:

16632
7 2
1 1 1 1 1 1 1
1 1
7 2
1 1 1 1 1 1 1
1 2
7 2
1 1 1 1 1 1 1
1 3
7 2
1 1 1 1 1 1 1
1 4
7 2
1 1 1 1 1 1 1
1 5
7 2
1 1 1 1 1 1 1
1 6
7 2
1 1 1 1 1 1 1
2 2
7 2
1 1 1 1 1 1 1
2 3
7 2
1 1 1 1 1 1 1
2 4
7 2
1 1 1 1 1 1 1
2 5
7 2
1 1 1 1 1 1 1
2 6
7 2
1 1 1 1 1 1 1
3 3
7 2
1 1 1 1 1 1 1
3 4
7 2
1 1 ...

output:

-1
-1
-1
-1
-1
5
1 2 3 4 5 
-1
-1
5
1 1 2 3 1 
5
1 2 3 4 1 
-1
5
1 1 2 1 2 
5
1 2 3 1 2 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
5
1 1 1 2 3 
5
1 1 2 3 4 
5
2 3 4 5 1 
5
1 1 1 2 2 
5
1 1 2 3 2 
5
2 3 4 1 2 
-1
5
2 3 1 2 3 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
5
1 1 1 3 4 
5
1 1 3 4 5 
5...

result:

wrong answer Jury has answer but participant has not (test case 8)