제출 #1121537

#제출 시각아이디문제언어결과실행 시간메모리
1121537vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
100 / 100
427 ms8840 KiB
/** ██╗░░██╗████████╗██╗░░░░░███╗░░░███╗ ██║░░██║╚══██╔══╝██║░░░░░████╗░████║ ███████║░░░██║░░░██║░░░░░██╔████╔██║ ██╔══██║░░░██║░░░██║░░░░░██║╚██╔╝██║ ██║░░██║░░░██║░░░███████╗██║░╚═╝░██║ ╚═╝░░╚═╝░░░╚═╝░░░╚══════╝╚═╝░░░░░╚═╝ **/ #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define int l #define f first #define stop system("pause") #define ara <<" "<< #define s second #define endl '\n' #define l long long #define pb push_back #define pairs pair<l,l> #define all(v) v.begin(),v.end() #define yesno(v) ((v) ? "YES" : "NO") #define dbg(x) cout<<#x<<" = "<<x<<endl; #define filereader() ifstream cin(input); #define fileprinter() ofstream cout(output); #define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL); using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less_equal<int> , rb_tree_tag, tree_order_statistics_node_update> indexed_set; l gcd(l a, l b){ return (b == 0) ? a : gcd(b, a%b); } const l N = 2e5 + 5; const l INF = 1e18; const l mod = 1e9 + 7; const string input = "input.txt"; const string output = "output.txt"; void solve(){ l n,b; cin>>n>>b; l a[n]; for(int i = 0 ; i< n ; i++){ cin>>a[i]; } l p1 = min(20LL , n); l p2 = n - p1; vector<l>v; for(int i = 0; i < (1 << p1);i++){ l k = 0; for(int j = 0; j < p1; j++){ if(i & ( 1 << j) ){ k += a[j]; } } //cout<<i<<" "<<k<<endl; if(k <= b) v.pb(k); } sort(all(v)); l ans = 0; for(int i = 0 ; i < (1 << p2) ; i++ ){ l k = 0; for(int j = p1; j < n ; j++){ if(i & (1 << (j - p1) ) ){ k += a[j]; } } ans += upper_bound(all(v) , b - k) - lower_bound(all(v) , 0); } cout<<ans<<endl; } signed main(){ //fast; system("color a"); l n = 1; //cin>>n; while(n--){ solve(); } }

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

bobek.cpp: In function 'int main()':
bobek.cpp:100:11: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  100 |     system("color a");
      |     ~~~~~~^~~~~~~~~~~
#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...