Submission #886700

#TimeUsernameProblemLanguageResultExecution timeMemory
886700vjudge1San (COCI17_san)C++17
48 / 120
62 ms448 KiB
#ifndef Local #pragma GCC optimize("O3,unroll-loops") const int lim=10e5+100; #else const int lim=2e3+100; #endif #include "bits/stdc++.h" using namespace std; #define int int64_t #define pb push_back const int mod=1e9+7; using pii=pair<int,int>; inline void solve(){ int n,k; cin>>n>>k; pii a[n]; for(int i=0;i<n;i++){ cin>>a[i].first>>a[i].second; } int ans=0; for(int m=1;m<(1<<n);m++){ int past=-1,cur=0; for(int i=0;i<n;i++){ if(!(m&(1<<i)))continue; if(!(~past)||a[past].first<=a[i].first){ cur+=a[i].second; past=i; }else{ goto nextt; } } if(k<=cur){ //cerr<<"passed "<<(bitset<4>(m))<<" "<<cur<<"\n"; ans++; continue; } nextt:; //cerr<<"failed "<<(bitset<4>(m))<<"\n"; } cout<<ans<<"\n"; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #ifdef Local freopen(".in","r",stdin); freopen(".out","w",stdout); #else //freopen("grass.in","r",stdin); //freopen("grass.out","w",stdout); #endif int t=1; //cin>>t; while (t--) { solve(); } }
#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...