# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166657 | ArKCa | San (COCI17_san) | C++17 | 1072 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;
int g[N],h[N],n,k;
vector<int>v[N];
int solve(int x,int mani){
// printf("%d %d\n",x,mani);
ll ans=0;
if(mani+g[x]>=k){
ans=1;
}
for(int 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("%d %d",&n,&k);
for(int i=0;i<n;i++){
scanf("%d %d",&h[i],&g[i]);
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(h[j]>=h[i]){
v[i].pb(j);
}
}
}
ll ans=0;
for(int 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... |