QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#472060 | #4928. Game With Numbers | zjh114514 | Compile Error | / | / | C++14 | 743b | 2024-07-11 14:09:15 | 2024-07-11 14:09:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const long long N=2e4+5;
long long n,m;
long long b[N];
long long solve(long long dep,vector<long long> v)
{
if(dep>m)
{
long long cnt=0;
for(auto it:v) cnt+=it;
return cnt;
}
if(!v.size()) return 0;
vector<long long> p,q;
for(auto it:v)
{
if(it%b[dep]) p.push_back(it);
else q.push_back(it);
}
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;
long long sum=0;
if(m>100) puts('0'),0;
vector<long long> v;
for(int i=1;i<=n;i++)
{
long long x;
cin>>x;
v.push_back(x);
sum+=x;
}
for(int i=1;i<=m;i++) cin>>b[i];
cout<<solve(1,v);
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:28:24: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive] 28 | if(m>100) puts('0'),0; | ^~~ | | | char In file included from /usr/include/c++/13/cstdio:42, from /usr/include/c++/13/ext/string_conversions.h:45, from /usr/include/c++/13/bits/basic_string.h:4097, from /usr/include/c++/13/string:54, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:1: /usr/include/stdio.h:632:30: note: initializing argument 1 of ‘int puts(const char*)’ 632 | extern int puts (const char *__s); | ~~~~~~~~~~~~^~~