Submission #1121493

#TimeUsernameProblemLanguageResultExecution timeMemory
1121493vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
100 / 100
433 ms20904 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define FORI(i, n) for(ll i = 0; i < n; i++) #define FOR(i, n) for(ll i = 1; i <= n; i++) typedef vector<ll> vl; typedef set<ll> setl; #define ff first #define ss second #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define db double #define nll cout << "\n" #define nl "\n" #define sync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); const ll INF = 1e9 + 7; const int MAX = 3e5 + 5; ll n, m, k; ll a[MAX]; void solve(){ cin >> n >> m; FOR(i, n)cin >> a[i]; vl v1, v2; FOR(i, n / 2)v1.push_back(a[i]); vl a1, a2; for(ll i = n / 2 + 1; i <= n; i++)v2.push_back(a[i]); for(ll mask = 0; mask < (1 << v1.size()); mask++){ ll sum = 0; for(ll i = 0; i < v1.size(); i++){ if((1 << i) & mask)sum += v1[i ]; } a1.push_back(sum); } for(ll mask = 0; mask < (1 << v2.size()); mask++){ ll sum = 0; for(ll i = 0; i < v2.size(); i++){ if((1 << i) & mask)sum += v2[i]; } a2.push_back(sum); } sort(all(a2)); ll res = 0; for(auto i : a1){ res += (upper_bound(all(a2), m - i) - a2.begin()); } cout << res << nl; } signed main(){ sync; ll t = 1; // cin >> t; while(t--) { solve(); } }

Compilation message (stderr)

bobek.cpp: In function 'void solve()':
bobek.cpp:31:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(ll i = 0; i < v1.size(); i++){
      |                       ~~^~~~~~~~~~~
bobek.cpp:38:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(ll i = 0; i < v2.size(); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...