QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#250451#7678. The Gameucup-team2279WA 0ms3596kbC++141.2kb2023-11-13 10:00:522023-11-13 10:00:53

Judging History

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

  • [2023-11-13 10:00:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2023-11-13 10:00:52]
  • 提交

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)