# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
842025 | Elvin_Fritl | Bootfall (IZhO17_bootfall) | C++17 | 208 ms | 592 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <string>
#include <bits/functexcept.h>
#include <iosfwd>
#include <bits/cxxabi_forced.h>
#include <bits/functional_hash.h>
#pragma push_macro("__SIZEOF_LONG__")
#pragma push_macro("__cplusplus")
#define __SIZEOF_LONG__ __SIZEOF_LONG_LONG__
#define unsigned unsigned long
#define __cplusplus 201102L
#define __builtin_popcountl __builtin_popcountll
#define __builtin_ctzl __builtin_ctzll
#include <bitset>
#pragma pop_macro("__cplusplus")
#pragma pop_macro("__SIZEOF_LONG__")
#undef unsigned
#undef __builtin_popcountl
#undef __builtin_ctzl
#include <bits/stdc++.h>
using namespace std;
const int N = 505 , inf = 1e9 + 199;
int32_t main()
{
int n;
cin>>n;
int a[n],sum=0;
for(int i=0;i<n;i++){
cin>>a[i];
sum += a[i];
}
vector<int>res;
for(int x=1;x<10000;x++){
bool as = true;
for(int k=0;k<n;k++){
vector<int>v;
for(int i=0;i<n;i++){
if(i == k){
continue;
}
v.push_back(a[i]);
}
int eded = (sum - a[k] + x);
if(eded%2 != 0){
as=false;
break;
}
eded/=2;
v.push_back(x);
bitset<N*N> dp;
dp[0] = true;
for(auto &ii:v){
dp |= (dp << ii);
}
if(dp[eded] == true){
continue;
}
as=false;
break;
dp.reset();
}
if(as == true){
res.push_back(x);
}
}
cout<<res.size()<<endl;
for(auto &i:res){
cout<<i<<" ";
}
}
/*
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |