Submission #154527

# Submission time Handle Problem Language Result Execution time Memory
154527 2019-09-22T13:27:58 Z phillip San (COCI17_san) C++14
48 / 120
1000 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
int ans;
long long k;
void ed(long long sum)
{
    if(sum>=k)ans++;
}
int n;
long long h[49],g[49];
void bt(int x,long long sum)
{
    sum+=g[x];
    ed(sum);
    for(int i=x+1;i<n;i++)
    {
        if(h[i]>=h[x])
        {
            bt(i,sum);
        }
    }
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>h[i]>>g[i];
    for(int i=0;i<n;i++)
    {
        bt(i,0);
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -