Submission #680959

#TimeUsernameProblemLanguageResultExecution timeMemory
680959Cross_RatioIce Hockey World Championship (CEOI15_bobek)C++14
40 / 100
108 ms17400 KiB
#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 (stderr)

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 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...