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

WA #4
Posted by Hi4ko 14 Dec 2011 21:54
Why?

#include <iostream>
#include <string>
using namespace std;
int main()
{
int hun[100],sat[100],N,maxhun=0,minsat=0;
cin>>N;
int numhun=0,numsat=0;
for(int i=0;i<N;i++)
{
int temp;
string lol;
cin>>temp>>lol;
if(lol=="hungry")
{
hun[numhun]=temp;
++numhun;
}
else
{
sat[numsat]=temp;
++numsat;
}
}
for(int i=1;i<numhun;i++)
    if(hun[i]>hun[maxhun])
        maxhun=i;
for(int i=1;i<numsat;i++)
    if(sat[i]<sat[minsat])
        minsat=i;
if(numsat==0 || N==0)
    cout<<10;
else
    if(hun[maxhun]>=sat[minsat])
        cout<<"Inconsistent";
else
    cout<<sat[minsat];
}