Submission #710622

# Submission time Handle Problem Language Result Execution time Memory
710622 2023-03-15T12:32:15 Z groshi Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
443 ms 8656 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<int> Q;
int t[2000000];
int32_t main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    cin>>t[i];
    for(int i=0;i<(1<<(n/2));i++)
    {
        int pom=i;
        int gdzie=0;
        int suma=0;
        while(pom>0)
        {
            if(pom%2==1)
            suma+=t[gdzie];
            pom/=2;
            gdzie++;
        }
        Q.push_back(suma);
    }
    sort(Q.begin(),Q.end());
    int wynik=0;
    for(int i=0;i<(1<<((n+1)/2));i++)
    {
        int pom=i;
        int gdzie=0;
        int suma=0;
        while(pom>0)
        {
            if(pom%2==1)
                suma+=t[gdzie+n/2];
            pom/=2;
            gdzie++;
        }
        gdzie=upper_bound(Q.begin(),Q.end(),m-suma)-Q.begin();
        gdzie--;
        if(gdzie>=0)
            wynik+=gdzie+1;
    }
    cout<<wynik;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 984 KB Output is correct
2 Correct 93 ms 2508 KB Output is correct
3 Correct 433 ms 8632 KB Output is correct
4 Correct 86 ms 2512 KB Output is correct
5 Correct 14 ms 984 KB Output is correct
6 Correct 6 ms 728 KB Output is correct
7 Correct 12 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1484 KB Output is correct
2 Correct 29 ms 984 KB Output is correct
3 Correct 168 ms 4512 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 7 ms 728 KB Output is correct
6 Correct 13 ms 984 KB Output is correct
7 Correct 13 ms 1032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 1480 KB Output is correct
2 Correct 138 ms 2528 KB Output is correct
3 Correct 140 ms 2512 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 81 ms 2512 KB Output is correct
6 Correct 200 ms 8636 KB Output is correct
7 Correct 69 ms 2508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 301 ms 4556 KB Output is correct
2 Correct 28 ms 984 KB Output is correct
3 Correct 9 ms 720 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 7 ms 728 KB Output is correct
6 Correct 146 ms 4524 KB Output is correct
7 Correct 12 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 984 KB Output is correct
2 Correct 85 ms 2504 KB Output is correct
3 Correct 8 ms 720 KB Output is correct
4 Correct 8 ms 728 KB Output is correct
5 Correct 103 ms 2500 KB Output is correct
6 Correct 17 ms 984 KB Output is correct
7 Correct 207 ms 8564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 335 ms 8584 KB Output is correct
2 Correct 30 ms 984 KB Output is correct
3 Correct 9 ms 728 KB Output is correct
4 Correct 443 ms 8656 KB Output is correct
5 Correct 122 ms 4556 KB Output is correct
6 Correct 13 ms 984 KB Output is correct
7 Correct 24 ms 1488 KB Output is correct