Submission #50598

# Submission time Handle Problem Language Result Execution time Memory
50598 2018-06-11T21:11:54 Z XmtosX San (COCI17_san) C++17
48 / 120
1000 ms 544 KB
#include <bits/stdc++.h>
using namespace std;
int n;
long long c[50],h[50],k;
long long bt(int pos,long long last,long long sum)
{
    if (pos==n)
        return (sum>=k);
    long long ans=0;
    if (h[pos]>=last)
        ans=bt(pos+1,h[pos],sum+c[pos]);
    ans+=bt(pos+1,last,sum);
    return ans;
}
int main()
{
    cin >>n>>k;
    for (int i=0;i<n;i++)
        cin >>h[i]>>c[i];
    cout << bt(0,0,0);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 496 KB Output is correct
2 Correct 2 ms 496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 544 KB Time limit exceeded
2 Halted 0 ms 0 KB -