Submission #473270

# Submission time Handle Problem Language Result Execution time Memory
473270 2021-09-15T11:11:05 Z AbdoMo San (COCI17_san) C++17
0 / 120
4 ms 936 KB
#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];
    }
    set<vector<int>>st;
    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;

        vector<int>taken;
        for(int i=0;i<v.size();i++)
        {
            //cout<<v[i]<<" ";
            if(arr[v[i]][0]>=mx)
            {
                taken.pb(v[i]);
                mx=arr[v[i]][0];
                x+=arr[v[i]][1];
            }
        }
        if(x>=k)
        {
            st.insert(taken);
            //cout<<"up"<<endl;
            ans++;
        }
    }
    cout<<st.size()<<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

san.cpp: In function 'void solve()':
san.cpp:40:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int i=0;i<v.size();i++)
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 936 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -