제출 #1121583

#제출 시각아이디문제언어결과실행 시간메모리
1121583MoonnIce Hockey World Championship (CEOI15_bobek)C++17
100 / 100
356 ms20892 KiB
#include <bits/stdc++.h> #define ll long long #define endl "\n"; #define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; int main() { ll n,m,i; cin>>n>>m; ll a[n]; for(i=0;i<n;i++) cin>>a[i]; vector<ll>h1; vector<ll>h2; for(ll mask=0;mask<(1<<(n/2));mask++) { ll sum=0; for(ll i=0;i<n/2;i++)//0 1 2 { if(mask&(1<<i)) sum+=a[i]; } if(sum<=m) h1.push_back(sum); } for(ll mask=0;mask<(1<<(n/2+n%2));mask++) { ll sum=0; for(ll i=0;i<n/2+n%2;i++)// { if(mask&(1<<i)) sum+=a[n/2+i]; } // cout<<mask<<' '<<sum<<endl; if(sum<=m) h2.push_back(sum); } sort(h1.begin(),h1.end()); sort(h2.begin(),h2.end()); ll say=0; /* for(i=0;i<h1.size();i++) cout<<h1[i]<<' '; cout<<endl; for(i=0;i<h2.size();i++) cout<<h2[i]<<' ';*/ for(i=0;i<h1.size();i++) say+=upper_bound(h2.begin(),h2.end(),m-h1[i])-h2.begin(); cout<<say; }

컴파일 시 표준 에러 (stderr) 메시지

bobek.cpp: In function 'int main()':
bobek.cpp:46: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]
   46 |     for(i=0;i<h1.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...