ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1546. Japanese Sorting

What's wrong with my algo?
Posted by inkognito 6 Mar 2008 21:20
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
bool lesslength(const string& s1, const string& s2)
{
    return s1.length()<s2.length();
}
int main()
{
    string s;
    vector<string>a;
    while((cin>>s))

    {

        a.push_back(s);

    }
    stable_sort(a.begin(),a.end(),lesslength);
    vector<string>::iterator pos;
    for ( pos = a.begin(); pos != a.end(); ++pos)
    {
        cout<<*pos<<endl;
    }
    return 0;
}

I've WA 2.
Re: What's wrong with my algo?
Posted by Denis Koshman 14 Jul 2008 20:29
It's not just about length