Submission #680960

# Submission time Handle Problem Language Result Execution time Memory
680960 2023-01-12T06:43:51 Z Cross_Ratio Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
201 ms 20832 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int A[45];
vector<int> B, C;
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N, M;
    cin >> N >> M;
    int i, j;
    for(i=0;i<N;i++) cin >> A[i];
    B.push_back(0);
    for(i=0;i<min(20LL, N);i++) {
        int sz = B.size();
        for(j=0;j<sz;j++) B.push_back(B[j] + A[i]);
    }
    C.push_back(0);
    for(i=20;i<N;i++) {
        int sz = C.size();
        for(j=0;j<sz;j++) C.push_back(C[j] + A[i]);
    }
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    j = (int)B.size() - 1;
    int ans = 0;
    for(i=0;i<C.size();i++) {
        while(j>=0&&B[j]+C[i]>M) j--;
        ans += j+1;
    }
    cout << ans;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:28:14: 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]
   28 |     for(i=0;i<C.size();i++) {
      |             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 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 0 ms 212 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1364 KB Output is correct
2 Correct 5 ms 856 KB Output is correct
3 Correct 10 ms 1492 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 3 ms 1028 KB Output is correct
6 Correct 96 ms 8680 KB Output is correct
7 Correct 11 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 8648 KB Output is correct
2 Correct 20 ms 2512 KB Output is correct
3 Correct 5 ms 856 KB Output is correct
4 Correct 5 ms 984 KB Output is correct
5 Correct 49 ms 8676 KB Output is correct
6 Correct 10 ms 1364 KB Output is correct
7 Correct 10 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 8664 KB Output is correct
2 Correct 99 ms 9468 KB Output is correct
3 Correct 201 ms 20788 KB Output is correct
4 Correct 92 ms 9540 KB Output is correct
5 Correct 48 ms 8776 KB Output is correct
6 Correct 80 ms 8636 KB Output is correct
7 Correct 90 ms 8648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 8772 KB Output is correct
2 Correct 85 ms 8596 KB Output is correct
3 Correct 84 ms 12612 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 41 ms 8648 KB Output is correct
6 Correct 76 ms 8584 KB Output is correct
7 Correct 90 ms 8648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 87 ms 9004 KB Output is correct
2 Correct 112 ms 10508 KB Output is correct
3 Correct 113 ms 10556 KB Output is correct
4 Correct 20 ms 2512 KB Output is correct
5 Correct 43 ms 10552 KB Output is correct
6 Correct 139 ms 20832 KB Output is correct
7 Correct 98 ms 10564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 16728 KB Output is correct
2 Correct 92 ms 8660 KB Output is correct
3 Correct 92 ms 8648 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
5 Correct 57 ms 8624 KB Output is correct
6 Correct 139 ms 16760 KB Output is correct
7 Correct 90 ms 8688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 8648 KB Output is correct
2 Correct 94 ms 9540 KB Output is correct
3 Correct 86 ms 8648 KB Output is correct
4 Correct 91 ms 8648 KB Output is correct
5 Correct 53 ms 10584 KB Output is correct
6 Correct 99 ms 8648 KB Output is correct
7 Correct 173 ms 20804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 181 ms 20832 KB Output is correct
2 Correct 92 ms 8648 KB Output is correct
3 Correct 92 ms 8664 KB Output is correct
4 Correct 190 ms 20792 KB Output is correct
5 Correct 54 ms 12560 KB Output is correct
6 Correct 93 ms 8748 KB Output is correct
7 Correct 90 ms 8800 KB Output is correct