Submission #842024

#TimeUsernameProblemLanguageResultExecution timeMemory
842024Elvin_FritlBootfall (IZhO17_bootfall)C++17
0 / 100
40 ms348 KiB
#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<2000;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)

bootfall.cpp:9: warning: "__SIZEOF_LONG__" redefined
    9 | #define __SIZEOF_LONG__ __SIZEOF_LONG_LONG__
      | 
<built-in>: note: this is the location of the previous definition
bootfall.cpp:11: warning: "__cplusplus" redefined
   11 | #define __cplusplus 201102L
      | 
<built-in>: note: this is the location of the previous definition
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...