Submission #473309

# Submission time Handle Problem Language Result Execution time Memory
473309 2021-09-15T11:53:49 Z Ahmed57 San (COCI17_san) C++14
0 / 120
66 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<pair<int,int>> arr(42);
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>k;
    for(int i = 0;i<n;i++){
        int a,b;cin>>a>>b;
        arr[i] = {a,b};
    }
    arr[40]={0,0};
    long long ans = 0;
    if(n<=20){
        for(int mask=0;mask<(1<<n);mask++){
            long long s=0,p=40;
            for(int i=0;i<n;i++){
                if((1<<i)&mask){
                    if(arr[i].first>=arr[p].first){
                        s+=arr[i].second;
                    }
                    else{
                        s=-1;
                        break;
                    }
                    p=i;
                }
            }
            if(s>=k)ans++;
        }
    }
    cout<<ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 66 ms 204 KB Output is correct
2 Incorrect 5 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 -