Submission #473275

#TimeUsernameProblemLanguageResultExecution timeMemory
473275AbdoMoSan (COCI17_san)C++17
0 / 120
1080 ms2360 KiB
#include<bits/stdc++.h> //#define int long long #define ll long long #define pb push_back const int mod = 1e9+7; using namespace std; bool comp(string a,string b) { if(a.size()==b.size()) { return a<b; } return a.size()<b.size(); } void solve(){ int n,k; cin>>n>>k; int arr[n][2]; int ans=0; for(int i=0;i<n;i++) { cin>>arr[i][0]>>arr[i][1]; } for(int mask=1;mask<(1<<n);mask++) { vector<int>v; for(int i=0;i<(1<<n);i++) { if((mask&(1<<i))) { v.pb(i); } } int x=0; //cout<<v[0]<<" "; int mx=0; bool flag=0; for(int i=0;i<v.size();i++) { //cout<<v[i]<<" "; if(arr[v[i]][0]>=mx) { mx=arr[v[i]][0]; x+=arr[v[i]][1]; } else { flag=1; break; } } if(flag==0 && x>=k) { //cout<<"up"<<endl; ans++; } } cout<<ans<<endl; } int32_t main(){ int t=1; ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // cin>>t; while(t--){solve();} return 0; }

Compilation message (stderr)

san.cpp: In function 'void solve()':
san.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int i=0;i<v.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...