# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154553 | phillip | San (COCI17_san) | C++14 | 162 ms | 65540 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 lp (pos+pos+1)
#define rp (2*pos+2)
#define m (l+r)/2
using namespace std;
vector<ll>v[49];
ll h[49],g[49],k,ans;
int n;
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++)
{
cin>>h[i]>>g[i];
}
for(int i=n-1;i>=0;i--)
{
v[i].push_back(g[i]);
for(int j=0;j<i;j++)
{
if(h[j]>h[i])continue;
for(int l=0;l<v[i].size();l++)v[j].push_back(g[j]+v[i][l]);
}
for(int j=0;j<v[i].size();j++)
{
if(v[i][j]>=k)ans++;
}
//cout<<ans<<"\n";
v[i].clear();
}
cout<<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... |