Dominik Michniewski wrote:Yesterday I got Accepted on this problem without sorting input sequence, so I can assume, that sorting isn't necessary. It implies, that every sequence in which order of elements after sorting is different from original order isn't A-Sequence.
Best regards
DM
If you can get AC without sorting, I think for this problem all the judge test input is in the sorted order.
Unfortunately, there is an input where the value 1003 appears. I have already seen the input of this problems many times, but I could only see this error now
I will try to fix this error and to send the new input to UVA's site.
ID Submission date Problem Previous Fixed verdict
-------- -------------------- ------- -------- -------------
04051252 2005/10/19 23:03 UTC 10930 WA RE
04051262 2005/10/19 23:11 UTC 10930 AC RE
However, submitting the same code that was supposed to RE gave me AC a minute ago (and it's not the case that I was lucky this time, the code is correct).
nump should be initialize.
I fix it but it does not help me to get AC.
Can you give me some more input output?
I test all the input in this board and my solution give correct answer for those inputs.
Never argue with an idiot, they'll drag you down to their level and beat you with experience! (unknown)
/*************************************************************/
/* MCA03901 SPIDER 7/2/06 */
/*************************************************************/
#include<stdio.h>
#define MAX 1000000
long long int array[MAX],d,seq[MAX],add[MAX],i,temp,seq_flag=0,count=1;
main(){
for(count=1;;count++){
scanf("%lld",&d);
seq_flag=1;
seq[0]=0;
for(i=1,temp=0;i<=d;i++){
scanf("%lld",&seq[i]);
temp+=seq[i];
if(seq[i]>seq[i-1] && seq_flag==1 && array[seq[i]]!=count &&add[seq[i]]!=count){
array[seq[i]]=count;
add[temp]=count;
}
else seq_flag=0;
}
printf("Case #%lld:",count);
for(i=1;i<=d;i++)printf(" %lld",seq[i]);
printf("\n");
switch(seq_flag){
case 1:printf("This is an A-sequence.\n");break;
case 0:printf("This is not an A-sequence.\n");break;
}
}
}
i used the following algorithm...
first i printed the given input.
then sorted it.
then i checked whether a number can be expressed as a sum of two or more numbers.
but it gave wrong answer.
and 1 more thing.. do we really need to sort the input? because that can change the relative order of the input and hance the term "sum of two or more distinct earlier terms of the sequence." will not have any meaning.