Submission #166663

# Submission time Handle Problem Language Result Execution time Memory
166663 2019-12-03T12:07:11 Z muhi1112 San (COCI17_san) C++17
0 / 120
1000 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=45;

ll n,k,height[N],val[N],ans;
vector<ll>v[N];

ll solve(int i,int m){
	ll ans=0;
	for(auto j:v[i]){
		ans+=solve(j,m+val[j]);
	}
	if(m>=k)return ans+1;
	return ans;
}

int main(){
	//fri("in.txt");
	//fro("out.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>height[i]>>val[i];
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(height[j]>=height[i]){
				v[i].pb(j);
			}
		}
	}
	for(int i=0;i<n;i++){
		ans+=solve(i,val[i]);
	}
	cout<<ans<<endl;
return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -