|
|
back to boardDiscussion of Problem 1322. SpyShow all messages Hide all messageswho can tell me what the test6 is? Thanks 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; } Use stable_sort instead of sort (if you're doing on C/C++) |
|
|