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 1644. A Whole Lot of Walnuts

HTL[1 course of RAU] WHAT IS WRONG?????? // Problem 1644. A Whole Lot of Walnuts 19 Apr 2010 20:47
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N=100;
int main()
{
    int n,i,k;
    int x[N],y[N];
    string z[N];
    int total_s=0,total_h=0;
    cin>>n;
    cin>>ws;
    for(i=0;i<n;i++)
    {
        getline(cin,z[i]);
    }
    for(i=0;i<n;i++)
    {
        if(z[i][2]=='s')
        {
            y[total_s++]=z[i][0]-48;
        }
        if(z[i][2]=='h')
        {
            x[total_h++]=z[i][0]-48;
        }
    }
    sort(x,x+total_h);
    sort(y,y+total_s);
    if(total_s==0)
    {
        cout<<"10"<<endl;
    }
    else
    {
        if(y[0]<=x[total_h-1])
        {
            cout<<"Inconsistent"<<endl;
        }
        else
        {
            cout<<y[0]<<endl;
        }

    }
    return 0;
}