Submission #222245

#TimeUsernameProblemLanguageResultExecution timeMemory
222245DodgeBallManIce Hockey World Championship (CEOI15_bobek)C++14
0 / 100
776 ms1048580 KiB
#include <bits/stdc++.h> using namespace std; int n; long long m, va[2][25], s[2], ans; vector<long long> all[2]; void permute( int ty, int now, int ok, long long sum = 0 ) { if( ok ) sum += va[0][now]; if( now == s[ty] ) { all[ty].emplace_back( sum ); return ; } permute( ty, now+1, 0, sum ), permute( ty, now+1, 1, sum ); } int main() { scanf("%d %lld",&n,&m); s[0] = n/2; s[1] = n - s[0]; for( int i = 1 ; i <= s[0] ; i++ ) scanf("%lld",&va[0][i]); for( int i = 1 ; i <= s[1] ; i++ ) scanf("%lld",&va[1][i]); permute( 0, 1, 0 ), permute( 0, 1, 1 ); permute( 1, 1, 0 ), permute( 1, 1, 1 ); sort( all[0].begin(), all[0].end() ), sort( all[1].begin(), all[1].end() ); for( long long i : all[0] ) { long long temp = m - i; int idx = upper_bound( all[1].begin(), all[1].end(), temp ) - all[1].begin(); ans += ( long long )idx; } printf("%lld",ans); return 0; }

Compilation message (stderr)

bobek.cpp: In function 'int main()':
bobek.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %lld",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~~~
bobek.cpp:23:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 1 ; i <= s[0] ; i++ ) scanf("%lld",&va[0][i]);
                                        ~~~~~^~~~~~~~~~~~~~~~~~
bobek.cpp:24:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 1 ; i <= s[1] ; i++ ) scanf("%lld",&va[1][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...