|  | 
|  | 
| back to board | Discussion of Problem 1322. Spywa#6... Posted by visitor  16 Jan 2007 10:59who can tell me what the test6 is? ThanksRe: wa#6... If you are using sort in your algo and sorting pairs<char ch,int position>, you must compare this pairs by a "ch", but if "ch"`s are equal - you must compare "position". Comparsion function may be like that:
 struct s{char c;int p;};
 
 bool cmp(s a, s b)
 {
 if(a.c!=b.c)
 {
 return a.c<b.c;
 }
 return a.p<b.p;
 }
Re: wa#6... Use stable_sort instead of sort (if you're doing on C/C++) | 
 | 
|