Submission #1121508

#TimeUsernameProblemLanguageResultExecution timeMemory
1121508vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
40 / 100
1093 ms295768 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld double const int INF = 1e18; const int mod = 12345; const int sz = 3e5 + 5; const int usz = 1e6 + 5; signed main() { ios_base::sync_with_stdio(0);cin.tie(0); int n , m; cin >> n >> m; vector < int > a(n); for(int i = 0;i < n;i++) cin >> a[i]; int ans = 0; set < vector < int > > s; for(int bit = 0;bit <= pow(2 , n);bit++) { int sum = 0; vector < int > q; for(int i = 0;i < n;i++) { if((1 << i) & bit) { sum += a[i]; q.push_back(i); } } if(m >= sum) { s.insert(q); } } cout << s.size() << endl; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:20:8: warning: unused variable 'ans' [-Wunused-variable]
   20 |    int ans = 0;
      |        ^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...