Submission #680959

# Submission time Handle Problem Language Result Execution time Memory
680959 2023-01-12T06:43:10 Z Cross_Ratio Ice Hockey World Championship (CEOI15_bobek) C++14
40 / 100
108 ms 17400 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[j]);
    }
    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 1 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1492 KB Output is correct
2 Correct 5 ms 984 KB Output is correct
3 Correct 10 ms 1492 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 964 KB Output is correct
6 Correct 108 ms 8580 KB Output is correct
7 Correct 11 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 8648 KB Output is correct
2 Correct 21 ms 2496 KB Output is correct
3 Correct 5 ms 856 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 50 ms 8648 KB Output is correct
6 Correct 11 ms 1492 KB Output is correct
7 Correct 11 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 17272 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 17364 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 17376 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 17400 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 17360 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 17384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -