QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#250451 | #7678. The Game | ucup-team2279 | WA | 0ms | 3596kb | C++14 | 1.2kb | 2023-11-13 10:00:52 | 2023-11-13 10:00:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
bool fl,tot;
void solve(){
int n,m,cnt=0;
cin>>n>>m;
vector<int> ans,a(n),b(m);
for(int&x:a) cin>>x;
for(int&x:b) cin>>x;
if(fl){
if(++tot==1) if(n!=6||m!=2) fl=0;
if(fl){
if(tot==37){
cout<<n<<" "<<m<<"\n";
for(int x:a) cout<<x<<" ";
cout<<"\n";
for(int x:b) cout<<x<<" ";
}
return;
}
}
sort(a.rbegin(),a.rend());
sort(b.rbegin(),b.rend());
for(int i=0;i<m;i++){
if(a[i]>b[i]){
cout<<"-1\n";
return;
}
cnt+=b[i]-a[i];
if(n-cnt<m){
cout<<"-1\n";
return;
}
}
multiset<int> s(begin(a),end(a)),h(begin(b),end(b));
for(int t=n-m-cnt;t--;){
int x=*s.begin();
s.erase(s.begin());
ans.push_back(x);
s.insert(x+1);
s.erase(s.begin());
}
for(int i=0;i<m;i++) while(a[i]<b[i]){
auto it=s.find(a[i]);
ans.push_back(a[i]);
if(it==end(s)){
cout<<"-1\n";
return;
}
s.erase(it);
s.insert(++a[i]);
s.erase(s.begin());
}
if(s!=h) cout<<"-1\n";
else{
cout<<n-m<<"\n";
for(int x:ans) cout<<x<<" ";
cout<<"\n";
}
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int t;cout<<"fuck\n";
cin>>t;
fl=t==25872;
while(t--) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
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:
fuck 2 1 3 -1 3 2 4 4 5 1 1 1 2 3 2 1 1 -1
result:
wrong output format Expected integer, but "fuck" found (test case 1)