QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#472207#4928. Game With Numbers0005Compile Error//C++20691b2024-07-11 15:03:452024-07-11 15:03:46

Judging History

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

  • [2024-07-11 15:03:46]
  • 评测
  • [2024-07-11 15:03:45]
  • 提交

answer

#include<iostream>
#include<vector> 
using namespace std;
long long n,m,s,x,b[20005];
long long solve(long long dep,vector<long long> v)
{
	if(dep>m){
		long long tot=0;
		for(auto x:v) tot+=x;
		return tot;
	}
	if(!v.size()) return 0;
	vector<long long> p,q;
	for(auto x:v){
		if(x%b[dep]) p.push_back(x);
		else q.push_back(x);
	}
	if(dep%2) return min(solve(dep+1,p),solve(dep+1,q));
	else return max(solve(dep+1,p),solve(dep+1,q));
 } 	
int main(){
	cin>>n>>m;
	vector<long long> V;
	if(m>100) {cout<<"0\n"; return 0;}
	for(long long i=1;i<=n;i++) {cin>>x; v.push_back(x); s+=x;}
	for(long long i=1;i<=m;i++) cin>>b[i];
	cout<<solve(1,V)<<"\n";
	return 0;
 } 

Details

answer.code: In function ‘int main()’:
answer.code:25:46: error: ‘v’ was not declared in this scope
   25 |         for(long long i=1;i<=n;i++) {cin>>x; v.push_back(x); s+=x;}
      |                                              ^