# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166659 | ArKCa | San (COCI17_san) | C++17 | 1066 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pob pop_back
#define N 45
using namespace std;
ll g[N],h[N],n,k;
vector<ll>v[N];
ll solve(ll x,ll mani){
// printf("%d %d\n",x,mani);
ll ans=0;
if(mani+g[x]>=k){
ans=1;
}
for(ll i=0;i<v[x].size();i++){
ans+=solve(v[x][i],mani+g[x]);
}
return ans;
}
int main(){
// freopen("a.gir","r",stdin);
// freopen("a.cik","w",stdout);
scanf("%lld %lld",&n,&k);
for(ll i=0;i<n;i++){
scanf("%lld %lld",&h[i],&g[i]);
}
for(ll i=0;i<n;i++){
for(ll j=i+1;j<n;j++){
if(h[j]>=h[i]){
v[i].pb(j);
}
}
}
ll ans=0;
for(ll i=0;i<n;i++){
ans+=solve(i,0);
}
printf("%lld\n",ans );
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |