All about problems in Volume 11. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
- New poster
- Posts: 3
- Joined: Thu Aug 08, 2013 5:41 pm
Code: Select all
//Nguyen Duc Anh
#define fi "1121.inp"
#define fo "1121.out"
using namespace std;
long tinh(int vt,int size)
if ( size == 0 )
if ( size + i > n )
if ( tinh(i,size) >= goc )
while (scanf("%ld %ld",&n,&goc) > 0 )
i dont know why still WA , who can give me some critical in/out ? ty so much
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
That code gets TLE. Try solving it in O(N).
Check input and AC output for thousands of problems on uDebug
Repon kumar Roy
- Learning poster
- Posts: 96
- Joined: Tue Apr 23, 2013 12:54 pm
Use Sliding Window to get AC
- A great helper
- Posts: 475
- Joined: Tue Jul 24, 2012 4:23 pm
I really need to know why the sample output is wrong for this problem. Unless I miss something from the below link:
https://uva.onlinejudge.org/index.php?o ... oblem=3562
The sample input is:
1 2 3 4 5
The sample output:
Should it be 3 instead of 5??
Yes, you're right. Thanks for sharing. It should be
If you're in doubt, please check
- New poster
- Posts: 13
- Joined: Fri May 02, 2014 9:45 pm
Just in case: you need to output 0 in case there is no such a subsequence with sum at least s.