Submission #166666

#TimeUsernameProblemLanguageResultExecution timeMemory
166666abilBootfall (IZhO17_bootfall)C++14
0 / 100
2 ms252 KiB
#include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mk make_pair #define all(s) s.begin(),s.end() //#define int long long using namespace std; const int N = (1e6 + 12); const int mod = (1e9 + 7); const int INF = (0x3f3f3f3f); int a[N]; main() { set<int > s; int n; cin >> n; for(int i = 1;i <= n; i++){ scanf("%d", &a[i]); s.insert(a[i]); } bool f = false; for(int mask = 1;mask < (1 << n); mask++){ int sum = 0, sum1 = 0; for(int i = 0;i < n; i++){ if(mask & i){ sum += a[i + 1]; } else{ sum1 += a[i + 1]; } } if(sum == sum1){ f = true; break; } } if(!f){ cout << 0; return 0; } cout << s.size() << endl; for(auto to : s){ cout << to << " "; } }

Compilation message (stderr)

bootfall.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
bootfall.cpp: In function 'int main()':
bootfall.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
#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...