Skip to content

Instantly share code, notes, and snippets.

@yasith
Created March 31, 2012 15:35
Show Gist options
  • Select an option

  • Save yasith/2266248 to your computer and use it in GitHub Desktop.

Select an option

Save yasith/2266248 to your computer and use it in GitHub Desktop.
TCO'11 Qual 1
int MinimumLiars::getMinimum(vector <int> claim) {
for (int i=0;i<claim.size();i++){
int count=0;
for (int j=0;j<claim.size();j++)
if(claim[j]>i+1)
count++;
if (count==i+1)
return i+1;
}
for (int i=0;i<claim.size();i++){
if (claim[i]!=0)
break;
if (i==claim.size()-1)
return 0;
}
return -1;
}
@yasith
Copy link
Author

yasith commented Mar 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment