답안 #838939

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
838939 2023-08-28T10:03:11 Z rahidilbayramli Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
329 ms 20808 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define all(v) v.begin(), v.end()
#define pb push_back
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
int main()
{
    ll n, m, i, j, ans = 0, sum = 0;
    cin >> n >> m;
    vl v(n), v1, v2, x, y;
    for(i = 0; i < n; i++)
    {
        cin >> v[i];
        if(i < (n + 1) / 2)
            v1.pb(v[i]);
        else
            v2.pb(v[i]);
    }
    ll a = v1.size(), b = v2.size();
    for(i = 0; i < 1 << a; i++)
    {
        sum = 0;
        for(j = 0; j < a; j++)
        {
            if((i >> j) & 1)
                sum += v1[j];
        }
        x.pb(sum);
    }
    for(i = 0; i < 1 << b; i++)
    {
        sum = 0;
        for(j = 0; j < b; j++)
        {
            if((i >> j) & 1)
                sum += v2[j];
        }
        y.pb(sum);
    }
    sort(all(x));
    sort(all(y));
    for(i = 0; i < x.size(); i++)
    {
        ll u = upper_bound(all(y), m - x[i]) - y.begin();
        ans += u;
    }
    cout << ans << "\n";
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:49:18: 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]
   49 |     for(i = 0; i < x.size(); i++)
      |                ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 224 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 236 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 2324 KB Output is correct
2 Correct 76 ms 5400 KB Output is correct
3 Correct 329 ms 20780 KB Output is correct
4 Correct 75 ms 5352 KB Output is correct
5 Correct 14 ms 1484 KB Output is correct
6 Correct 10 ms 852 KB Output is correct
7 Correct 19 ms 1592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 2772 KB Output is correct
2 Correct 27 ms 2324 KB Output is correct
3 Correct 128 ms 10492 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 6 ms 852 KB Output is correct
6 Correct 16 ms 1484 KB Output is correct
7 Correct 16 ms 1584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 4328 KB Output is correct
2 Correct 119 ms 8508 KB Output is correct
3 Correct 120 ms 8504 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 83 ms 8500 KB Output is correct
6 Correct 282 ms 20776 KB Output is correct
7 Correct 108 ms 8488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 245 ms 16708 KB Output is correct
2 Correct 27 ms 2332 KB Output is correct
3 Correct 9 ms 852 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 6 ms 964 KB Output is correct
6 Correct 230 ms 16712 KB Output is correct
7 Correct 16 ms 1572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 2468 KB Output is correct
2 Correct 80 ms 5448 KB Output is correct
3 Correct 9 ms 956 KB Output is correct
4 Correct 9 ms 852 KB Output is correct
5 Correct 82 ms 8380 KB Output is correct
6 Correct 26 ms 2260 KB Output is correct
7 Correct 310 ms 20752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 312 ms 20808 KB Output is correct
2 Correct 28 ms 2328 KB Output is correct
3 Correct 9 ms 852 KB Output is correct
4 Correct 326 ms 20768 KB Output is correct
5 Correct 106 ms 10552 KB Output is correct
6 Correct 16 ms 1568 KB Output is correct
7 Correct 32 ms 2784 KB Output is correct